gwillen / herring

Modern Django and ReactJS based web application for puzzlehunt team management!
MIT License
7 stars 4 forks source link

sync migration scripts with current models #5

Closed rhendric closed 4 years ago

gwillen commented 4 years ago

Can you explain this a little? Do we need to run this migration after merging, or is this just reflecting a change that we already made to the database, by hand or something (??), but didn't write a migration for?

rhendric commented 4 years ago

This came from Django complaining about a mismatch between the model as defined in the Python classes and the state of my dev database as created by the existing migration scripts. The warning came with instructions to run manage.py makemigrations, which produced this file. Looking at its contents, it seems only to be changing aspects of the database that aren't essential for Herring to function: some ordering preferences and a foreign key relationship. I don't know what model changes these correspond to (did you make them in your sprint last year?), but I doubt the corresponding changes were made to the prod database or else there'd probably be a migration script for them already. So you'll have to run a manage.py migrate—but you were already going to have to run one because of the model changes coming later.

gwillen commented 4 years ago

Ok, sounds good and we'll see what happens. I wonder if it's actually not that anything changed, but that, across however many versions we just upgraded, django changed how it manages the model-schema mapping a bit, and so the schema looks out of sync as a result.

You'll have to help me migrate prod, I assume you already migrated staging?

gwillen commented 4 years ago

Actually, it's possible there's no database schema effect here at all. The "AlterModelOptions" migration explicitly says in the docs that it does NOT touch the schema, it only touches some metadata that I don't understand where it is / how it's updated / what it's for.

I'm less sure about the AlterField but it looks like it may be doing the same sort of thing.