Skip to content

Merge Zone into Element

Erwan Rouchet requested to merge nuke-zones into master

Closes #787 (closed)

This cannot be split into some simple merge requests that just include the migration, then fixing each serializer, etc. because of the numerous imports and various other dependencies between classes. A lot of work was already required on arkindex.documents, arkindex.project and arkindex.images just to get Django to not crash on startup and properly create the migration. While I could split the branch later into many merge requests and act like nothing went wrong, having merge requests that depend on each other in this way would be a pain to rebase and test should there be any comment during a review.

  • Nuke
  • Fix tests
  • Check OpenAPI schema diff: erwanrouchet/schemadiff!3
  • Test locally
  • Test in Docker
  • Test on dev.arkindex.teklia.com
  • Party

Migration process

The migration has four parts:

  • documents.0038: Add the image and polygon fields to Element
  • documents.0039: Fill the image and polygon fields on Element with data from Zone
  • documents.0040: Drop the zone_id foreign key on Element
  • images.0008: Drop the zones

While the migration process can run just fine on smaller databases (e.g. arkindex-demo or local dev databases) in a few minutes, this can overwhelm some servers and require a lot of disk space. If you want to run the documents.0039 migration (the data migration) manually, you should first prevent anyone from trying to change the current zones, to avoid data loss. Assuming you are doing it right and not letting Arkindex be root on the database, you could login as postgres or some other superuser and run this to revoke write access to zones:

REVOKE INSERT, UPDATE, DELETE, TRUNCATE ON TABLE images_zone FROM <user>;

This might cause a lot of HTTP 500 errors as the backend is not designed at all to handle database privilege errors, but it will ensure that clients know that they can't create zones and know which attempts have failed, instead of having some of their new zones getting destroyed later.

Edited by Bastien Abadie

Merge request reports

Loading