Join GitHub today
Using autogenerate first time on multi-database env generates invalid revision file. #318
Migrated issue, originally created by pipoket (@pipoket)
I was looking into alembic to figure out whether i could use it on my project, but ended up finding out some strange behavior.
As my project is using multiple databases, I followed the documentation to prepare alembic environment and tried to generate 'initial' migration revision file with current database schema.
However, strangely, the revision file generated contained all the tables from every other database on single database upgrade/downgrade function. And as expected, running the migration on clean database using the revision file made all the tables to be created on single database.
How to Reproduce the Problem
Here is the minimized test case for reproducing what I explained above.
Model & Configurations
This is the
Alembic is configured like following:
Note that above
1. Make empty database for both tables
2. Try to generate revision file using autogenerate feature like blow
3. Generated revision file contains all the tables within single database, this is the problem.
4. Making first migration using file above creates all the tables within single database, as expected from the revision file itself.
I expected autogenerate feature to generate the revision file like fowllowing:
There is a possibility that I might have completely misunderstood the proper usage of alembic. If so, please feel free to let me know. Otherwise, I would really appreciate it if you look into the case above whether it is a bug or expected behavior.
Michael Bayer (@zzzeek) wrote: