[action required] Plugins should rebase their migrations

Does this apply to me?

If you are a plugin maintainer and that plugin ships database migrations, then probably, yes.

What should I do?

Migrations in Pulp plugins usually depend on a pulpcore migration at some point. However by the nature of dependency, plugin migrations can always run after all pulpcore migrations (e.g. when you install the plugin at a later point). In this very instance we request to bump the minimum depended on migration to ('core', '0091_systemid').
In the uncommon case your plugin depends on pulp_file, the same goes for ('file', '0017_alter_filealternatecontentsource_alternatecontentsource_ptr_and_more').

When should this happen?

This step should be taken no later than the plugin declaring compatibility with pulpcore 3.70 (breaking change release).

How can I do that?

There’s a management command helping with this effort:
pulpcore-manager rebasemigrations <app_label> core 0091

Please check the result. There’s no guarantee that tool is bullet proof. Specifically data migrations are not properly transformed. But looking at the result it should be obvious what change to pick.

2 Likes

Here’s a PR that does that and also squashes old migrations:

Since one of the goals of this excercise is to remove the BaseDistribution model from the database (we still need to decide if we want to do that now), I advise maintainers of plugins sufficiently old to have gone through the BaseDistribution migration, to also squash migrations to at least that point.

More info here: