4 ms·
Same here. Our backend team uses Python, SQLAlchemy and PG. They are looking for a tool to handle migrations and schema versionings. Any recommendations?
by ggregoire 8y ago
Same here. Our backend team uses Python, SQLAlchemy and PG. They are looking for a tool to handle migrations and schema versionings. Any recommendations?
- aidos 8y agoAlembic. It's made by zzzeek (Mike Bayer), who created SQLA and it's hackable to do custom migrations. We use it by changing the models in code and then having Alembic automatically create a suitable migration for us. Then we change the migration as required (adding steps for data migrations etc). It's really simple: alembic revision --autogenerate -m 'changing something...' That generates a python file with an upgrade and downgrade function. You can then customise fully as you require. Then on the db server you can run: alembic upgrade head # or downgrade etc
- crescentfresh 8y agoWe use the "forward only" approach, and use a combination of .sql and .py migration scripts and use mschematool[1] to tie the room together. [1] https://github.com/aartur/mschematool https://github.com/aartur/mschematool