Opened 9 years ago

Closed 9 years ago

#5413 closed defect (fixed)

Make models on clean database with alembic, not from models.py

Reported by: Jessica Tallon Owned by:
Priority: blocker Milestone: 0.9.0
Component: programming Keywords: database, migrations, alembic
Cc: Christopher Allan Webber, Boris Bobrov Parent Tickets:

Description

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.

Change History (3)

comment:1 by Christopher Allan Webber, 9 years ago

I agree we need this, but this is tricky, because we currently don't have a solution for alembic migrations with plugins... see #5424.

comment:2 by Christopher Allan Webber, 9 years ago

Alternately, we could put off #5424 (though we shouldn't put it off very long) and only initialize tables for non-plugin stuff.

But I worry a bit about that direction. We might get ourselves into trouble if we procrastinate on solving #5424 and close this issue.

comment:3 by Christopher Allan Webber, 9 years ago

Resolution: fixed
Status: newclosed

There we go... it's merged at last! I tested as well as I could and pushed. See the docs... there are a lot of changes to how things work...

Note: See TracTickets for help on using tickets.