当你调用
migrate命令Flask-Migrate(或实际上在其下的Alembic)时,它将查看你的命令
models.py并将其与数据库中的实际值进行比较。
你的迁移脚本为空的事实表明,你已通过Flask-Migrate无法控制的另一种方法(可能是通过调用Flask-SQLAlchemy的方法)更新了数据库以匹配你的模型
db.create_all()。
如果你的数据库中没有任何有价值的数据,请打开
Python Shell并调用
db.drop_all()以清空它,然后再次尝试自动迁移。
更新:我在这里安装了你的项目,并确认迁移对我来说工作正常:
(venv)[miguel@miguel-linux nhs-listpull]$ ./run.py db init Creating directory /home/miguel/tmp/mark/nhs-listpull/migrations...done Creating directory /home/miguel/tmp/mark/nhs-listpull/migrations/versions...done Generating /home/miguel/tmp/mark/nhs-listpull/migrations/script.py.mako...done Generating /home/miguel/tmp/mark/nhs-listpull/migrations/env.pyc...done Generating /home/miguel/tmp/mark/nhs-listpull/migrations/env.py...done Generating /home/miguel/tmp/mark/nhs-listpull/migrations/README...done Generating /home/miguel/tmp/mark/nhs-listpull/migrations/alembic.ini...done Please edit configuration/connection/logging settings in '/home/miguel/tmp/mark/nhs-listpull/migrations/alembic.ini' before proceeding.(venv)[miguel@miguel-linux nhs-listpull]$ ./run.py db migrateINFO [alembic.migration] Context impl SQLiteImpl.INFO [alembic.migration] Will assume non-transactional DDL.INFO [alembic.autogenerate] Detected added table 'list_type'INFO [alembic.autogenerate] Detected added table 'job' Generating /home/miguel/tmp/mark/nhs- listpull/migrations/versions/48ff3456cfd3_.py...done
尝试重新签出,我认为你的设置正确。



