是否可以使用 Alembic auto-generate migrations没有访问数据库的权限?
例如 django/south 可以通过 comparing the current version of a Model
against a previous snapshot of the Model
做到这一点.
最佳答案
不,这是不可能的。在 the relevant issue zzzeek 说
while the reflection-based comparison has its issues, it really is a very fundamental assumption these days particularly in the openstack world where autogen features are used in unit test suites to ensure the migrated schema matches the model. I don't have plans right now to pursue the datafile-based approach, it would be an enormous undertaking for a system that people seem to be mostly OK with as is.
尽管另一种方法可能是按需启动一个新数据库,从空到头运行迁移,针对它生成,然后丢弃数据库。
关于sqlalchemy - 没有数据库的 Alembic 迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35329752/