Specify a "version_num" for different schemas? #940
-
Is there a way to handle multiple Alembic environments, one for each schema in the same database? I asked a question on StackOverflow (https://stackoverflow.com/questions/69359861/alembic-put-a-version-num-for-each-schema) In short, in my team we have multiple projects on the same database, each project has a schema, and we want each project to be able to handle migrations/revisions independently of other projects. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hi, I think that's the defualt behaviour of alembic, just configure the sqlalchemy connection to point to the right schema when passed to alembic. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your quick answer, I'm relieved if this is the default behaviour of Alembic, yet I don't understand how I can manage my project if our team code is structured like this:
|
Beta Was this translation helpful? Give feedback.
Hi,
I think that's the defualt behaviour of alembic, just configure the sqlalchemy connection to point to the right schema when passed to alembic.
In your example you seem to want to use multiple
alembic.ini
files, so it should not require special consideration when running alembic like in this case https://alembic.sqlalchemy.org/en/latest/cookbook.html#multiple-environmentsFor more customization on the autogenerate, there is this section of the docs https://alembic.sqlalchemy.org/en/latest/autogenerate.html?highlight=schema#controlling-what-to-be-autogenerated