I have run flask db init with just one database (very long ago). Now I want to add a second database to my application.
I have already created the binds. But running flask db migrate is just ignoring my __bind_key__ set at the newly created model class.
I tried to run flask db init --multdib but this gives me alembic.util.exc.CommandError: Directory migrations already exists.
How can I tell flask-migrate I have two databases now?
I was able to convert a single-db repository to multi-db with the following procedure:
migrations folder to something else (i.e. migrations-old)flask db init --multidbmigrations-old/versions/* to migrations/versions.flask db stamp head (this marks the additional databases as being updated)migrations-oldAt this point you should have a repository that can track changes in all your databases.
Most helpful comment
I was able to convert a single-db repository to multi-db with the following procedure:
migrationsfolder to something else (i.e.migrations-old)flask db init --multidbmigrations-old/versions/*tomigrations/versions.flask db stamp head(this marks the additional databases as being updated)migrations-oldAt this point you should have a repository that can track changes in all your databases.