通过迁移更新数据库但不删除 python 中的任何 table
Update database through migrations but not delete any table in python
我有一个包含 10 个表的 PostgreSQL 数据库,但是在 python("flask_sqlalchemy") 中我只创建了 5 个模型并跳过了其他 5 个表,因为现在不需要了。但是当我尝试更新模型和 运行 迁移时,其他 5 个表被删除。
是否可以跳过或不删除5张表并更新其他表?
我正在使用 "flask_migrate" 包来执行迁移。
您可以使用 include_object option to specify which tables you want Alembic to ignore. There is an example that is close to what you need in .
我有一个包含 10 个表的 PostgreSQL 数据库,但是在 python("flask_sqlalchemy") 中我只创建了 5 个模型并跳过了其他 5 个表,因为现在不需要了。但是当我尝试更新模型和 运行 迁移时,其他 5 个表被删除。 是否可以跳过或不删除5张表并更新其他表? 我正在使用 "flask_migrate" 包来执行迁移。
您可以使用 include_object option to specify which tables you want Alembic to ignore. There is an example that is close to what you need in