Sometimes we want to share project code with DB migration scripts, e.g. utilities and models, for readability, usability, fast development and all that.
The issue is that each migration script should have its own copy of the shared code, or else we risk running past migrations with modified code. However, this creates a lot of overhead in copied only the used code and its dependencies, and avoiding mistakes.
The question is how to do this automatically? or better yet, am I wrong and should use a different approach?
Stack:
SQLAlchemy
- ormalembic
- generate migration scripts in aversions
directory inside our projectmysql
python3
of course