在迁移数据库时遇到问题使用了fake_Migration = false并删除了mysql的数据库,问题是我不想删除数据库,因为它中有一些重要的数据,我希望新的字段应该添加到表中而没有丢失数据并且不使用fake_Migration
答案 0 :(得分:1)
尝试以下方法:
db = DAL(...., fake_migrate_all=True, migrate=False) #This will not perform a real migration but will recreate metadata in your local 'databases' folder
python web2py.py -M -S <yourapp>
db = DAL(...., fake_migrate_all=False, migrate=True) #To migrate your database structure with the new fields in your model
db = DAL(...., fake_migrate_all=False, migrate=True)
更改为db = DAL(...., fake_migrate_all=False, migrate=False)
并最终添加lazy_tables=True
参数。更多信息:http://web2py.com/books/default/chapter/29/13/deployment-recipes#Efficiency-tricks