Implementing more guarantees to the package number storage in the historical database. See merge request !248