문제

In sqlalchemy-migrate repos, we can place .sql files instead of .py files under versions folder for upgrading/downgrading database schema.

001_mysql_downgrade.sql
001_mysql_upgrade.sql

Is the same feature exist in alembic? If yes can someone plz explain how to do?

Thanks

도움이 되었습니까?

해결책

you could call upon those files in your migration .py files, inside your upgrade() and downgrade() callables. You can customize how those callables render by editing your script.py.mako file.

However, for the .py file to not be there at all, you'd need to override ScriptDirectory and Script right now, unless we made more of a hook to implement extensions like this. Overriding those classes is possible but would likely require monkeypatching at the moment. It's certainly something Alembic could support.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top