Reputation: 10993
Is it possible to have Alembic auto-generate migrations without it having access to the database?
For example django / south are able to do this by comparing the current version of a Model
against a previous snapshot of the Model
.
Upvotes: 5
Views: 2059
Reputation: 1441
No, this isn't possible. In the relevant issue zzzeek said
while the reflection-based comparison has its issues, it really is a very fundamental assumption these days particularly in the openstack world where autogen features are used in unit test suites to ensure the migrated schema matches the model. I don't have plans right now to pursue the datafile-based approach, it would be an enormous undertaking for a system that people seem to be mostly OK with as is.
Though an alternative approach could be to spin up a new database on demand, run the migrations from empty to head, generate against it, then discard the database.
Upvotes: 2