0

My goal is to add a second database to my current project, using alembic. I have the default alembic folder, and using 'alembic init alembic_second' I created a second folder structure. I modified the env.py in the second folder and the root alembic.ini. When I run

alembic -n 'alembic_second' revision -m "create second"  --head=base  --version-path=alembic_second/versions --autogenerate

the output is:

postgresql:// (all the correct second database connection stuff)
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.

postgresql://(all the correct second database info)

The solution here doesn't work for me because my new versions folder is empty, my problem is I can't run my FIRST migration on this new database. As you can see in my terminal input, I am specifying the new versions folder.

Also, I put a print statement in my second env.py, and I am successfully seeing that, so it is hitting the correct env.py.

Any ideas on how to get past this error and create my first revision?

Thank you!

Community
  • 1
  • 1
lnhubbell
  • 3,304
  • 5
  • 17
  • 22

1 Answers1

0

It turns out that after I sorted through differences between the two database structures, the core problem was the same as the one I linked to, I just needed to add all of the proper flags to make it work with two databases. Running:

alembic -n 'alembic_second' stamp head --version-path=alembic_second/versions

solved my problems.

lnhubbell
  • 3,304
  • 5
  • 17
  • 22