In my team we have multiple projects/microservices all hosted on the same database, but each service has a specific schema.
I want to manage the migrations of each project independently of other projects, a way of achieving that could be to specify different environments to Alembic, with one environment specific to one schema.
Let's say I have two services : "service1" and "service2", each with a schema that have the name of the project. I'd like to have the following structure for my code:
team
├───service1
│ ├───requirements.txt
│ ├───main.py
│ └───alembic/
└───service2
├───requirements.txt
├───main.py
└───alembic/
I'd like to be able to
- navigate to
team/service1
- Create a migration and run it
- have this migration be executed on schema "service1"
- Go to
team/service2
- Create a migration and run it
- have this migration be executed on schema "service2"
Is this possible? How can I achieve this?