'Unable to auto-generate migrations using alembic
My repository can be found here http://goo.gl/Q4WJXy (versions inside alembic folder)and I tried to use autogenerate migrations,
alembic revision --autogenerate -m "some message"
there is nothing related to creation of table i.e empty downgrade and upgrade functions. I configured my local database properly. How can i solve this?
My log looks like this
INFO [alembic.migration] Context impl MySQLImpl.
INFO [alembic.migration] Will assume non-transactional DDL.
Target database is not up to date.
Thanks in advance
Solution 1:[1]
Basically Alembic compares your current database to your model and then generates the migration to get you database to be like your model.
I thought initially that the migrations is comparing latest revision with model, but actually it seems to ignore your revision file contents and is only looking to see if your database has the lates Alembic revision migration number.
So simply created the Alembic table and pasted the head revision number into it, in order for the migration to run and output the migration script I was looking for. Alternatively you upgrade your database properly to the latest revision using Alembic and then create the new migration.
alembic upgrade head
alembic revision --autogenerate -m 'test revision'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Zaffer |
