Skip to content

Model and migration to create internal references

Tim G requested to merge preprod into production

The evolution of the current model is necessary to be able to attach a creator to the relation given our permission system (creators can delete their creations).

I was not able to reuse the previous table without getting hit by Django's migrations system, hence the dedicated script to migrate the data and assign existing internal references relations to the admin_ap user.

Deployment procedure

$ python django/manage.py migrate
$ python django/manage.py shell_plus
>>> PassageInternalReference.objects.all().count()
806

Once we are sure that new objects exist, we can safely drop the old table:

$ psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB"
=> DROP TABLE "meleager_passage_internal_references";

Merge request reports