Comp-490-SeniorProject / site

MIT License
0 stars 1 forks source link

Update schema to new plan #64

Closed MarkKoz closed 2 years ago

MarkKoz commented 2 years ago

Resolves #48

There are quite a few custom migrations which were maybe a waste of time in hindsight. Both their application and reversal has been tested by me. The only migration that cannot be revsered is the one which deletes the priority field; the migration has no idea what the data in that column was and thus cannot restore it.

Either this PR or #60, depending on which is merged first, will need to be updated to account for the schema changes.

MarkKoz commented 2 years ago

Actually there is an issue with line 41 of 0006_parameter_test_1to1_2:

django.db.utils.IntegrityError: duplicate key value violates unique constraint "api_test_pkey"
DETAIL:  Key (id)=(2) already exists.

It seems if I keep trying to run the migration, it will eventually use an ID that isn't a duplicate. But the idea was for it to automatically figure out the next ID to increment to. For some reason that isn't working.

MarkKoz commented 2 years ago

I don't really want to spend time on fixing the migration bug right now. In practice, it would only happen if the DB is already populated with some tests when the migration is applied. Since we haven't deployed to production yet, any data in the DB is just local data for development purposes. The workaround is to either clear the database or just keep trying to apply the migration until it finally uses the right ID.