Make models on clean database with alembic, not from models.py
|Reported by:||Jessica Tallon||Owned by:|
|Component:||programming||Keywords:||database, migrations, alembic|
|Cc:||Christopher Allan Webber, Boris Bobrov||Parent Tickets:|
Currently, when there is a new database with nothing that has been done, we skip all the sqlalchemy-migrate migrations and just make the models based off models.py, we then run the alembic migrations. This actually causes problems when we start doing structural changes in alembic as they have already been done in models.py so when the alembic migrations run, they error.
One solution could be to skip all the alembic migrations, however, I think a better solution is to not make any models off models.py and instead make the initial alembic migration create all the models in the state they're in right now and use alembic migrations to change them in the future, removing all of the code to construct models from model.py.