Closed dawidratynski closed 2 months ago
This is probably caused by f55acf60fdc39f0bde9bc66762ea4a8ad1dfea92.
Created branches with implemented solutions for testing:
With deleting tables: https://github.com/dawidratynski/oioioi/tree/fix-oi-migration-v1
Without deleting tables: https://github.com/dawidratynski/oioioi/tree/fix-oi-migration-v2
I prefer solution without removing tables.
Migration 0002 in OI app causes db clearing to not work, by breaking the
python manage.py flush
command (and by extension:./easytoolbox.py flush-db
), which is needed for running cypress tests locally.File: https://github.com/sio2project/oioioi/blob/c3c399b02312dc1420aa43b474b9c01d10e9463e/oioioi/oi/migrations/0002_auto_20160412_1720.py
This migration removes Region and OIOnsiteRegistration models from the OI app, but does not delete their tables from the database (
migrations.SeparateDatabaseAndState
). Said tables contain non-nullable foreign key fields to other tables, causing an error when trying to clear the db, as Django only clears tables related to existing objects.Depending on whether deleting these tables is acceptable, I found two possible solutions:
If we can't delete the tables, we can make the foreign key fields nullable:
If we can delete said tables:
Both solutions fix the issue and pass all tests (as of 19.03.2024 / commit 056caf6).