> On Nov 17, 2014, at 10:20 AM, Ons <mribah....@gmail.com> wrote:
> 
> Hi,
> 
> I want to use alembic to auto-generate migrations scripts for my postgres db. 
> When i tried: 
> #alembic upgrade and  alembic downgrade both worked properly, but when i 
> modified my models and tried 
> #alembic revision --autogenerate it raises this error :
> 
> INFO  [alembic.migration] Context impl PostgresqlImpl.
> INFO  [alembic.migration] Will assume transactional DDL.
> ERROR [alembic.util] Target database is not up to date.
>   FAILED: Target database is not up to date.
> 
> In env.py, i imported my models and set target_metadata to 
> myModels.Base.metadata.
> 
> Anyone has an idea on how to solve this issue or what is causing the error 
> above ?

when you run alembic revision with —autogenerate, the database has to be 
up-to-date.  This means that the most “head” version that is in your versions/ 
directory must be the same version that is in your database in the 
“alembic_version” table.

So this means one of two things:

1. you need to run alembic upgrade

2. there is a version file in your versions/ directory that you don’t actually 
want, like you ran alembic revision already, it created a file, and you don’t 
actually want that file, you’d delete it first.

you can run “alembic history” to see all the versions that are in your 
versions/ directory in order.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy-alembic+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to