简体   繁体   English

Web2py PostgreSQL数据库

[英]Web2py postgreSQL database

Recently im working on web2py postgresql i made few changes in my table added new fields with fake_migration_all = true it does updated my .table file but the two new added fields were not able to be altered in postgres database table and i also tried fake_migration_all = false and also deleted mu .table file but still it didnt help to alter my table does able two add fields in datatable 最近我在web2py postgresql上工作,我在表中做了很少的更改,添加了带有fake_migration_all = true的新字段,它的确更新了我的.table文件,但是无法在postgres数据库表中更改这两个新添加的字段,我还尝试了fake_migration_all = false并且删除了mu .table文件,但仍然没有帮助改变我的表,并在datatable中添加了两个字段

Any better solution available so that i should not drop my data table and fields should also be altered/added in my table so my data shouldn't be loast 任何更好的解决方案都可以使用,这样我就不应删除我的数据表,并且还应在表中更改/添加字段,以免浪费我的数据

fake_migrate_all doesn't do any actual migration (hence the "fake") -- it just makes sure the metadata in the .table files matches the current set of table definitions (and therefore the actual database, assuming the table definitions in fact match the database). fake_migrate_all不会进行任何实际的迁移(因此称为“ fake”),它只是确保.table文件中的元数据与当前的表定义集匹配(因此与实际的数据库匹配,假设表定义实际上与数据库)。

If you want to do an actual migration of the database, then you need to make sure you do not have migrate_enabled=False in the call to DAL() , nor migrate=False in the relevant db.define_table() calls. 如果你想要做的数据库的实际迁移,那么你需要确保你没有migrate_enabled=False在调用DAL()也没有migrate=False在相关db.define_table()调用。 Unless you explicitly set those to false, migrations are enabled by default. 除非您将其显式设置为false,否则默认情况下会启用迁移。

Always a good idea to back up your database before doing a migration. 在进行迁移之前,备份数据库总是一个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM