Version is 2.12.3. >I believe you need to set both migrate=True and fake_migrate_all=True for the fake migrate to regenerate the .tables files. Thanks in fact with both to True all table files have been recreated.
Il giorno giovedì 21 aprile 2016 05:33:37 UTC+2, Michael Beller ha scritto: > > It sounds like you need to update the .tables files to match your database > and models. > > I believe you need to set both migrate=True and fake_migrate_all=True for > the fake migrate to regenerate the .tables files. > > Here's the logic in the book: > > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=fake#Migration-control-summary > > Have you tried setting both migrate and fake_migrate_all to True? > > On Wednesday, April 20, 2016 at 4:34:50 PM UTC-4, Gael Princivalle wrote: >> >> Hello. >> >> I'm still having some pain with DAL connection strings and migrations. >> >> In one application my DAL connection string is like that: >> DAL('postgres://username:password@localhost:5432/postg_db', >> check_reserved=['all'], pool_size=1, entity_quoting=True, bigint_id=True, >> migrate=False, fake_migrate_all=False) >> >> The application works well, but in the databases folder I have only >> tables form ckeditor and scheduler. >> If I set fake_migrate_all=True and run the application tables are not >> recreated. >> If I set migrate=True a ticket says me that relation "auth_user" already >> exists. >> So I'm unable to make modifications to this db. >> >> My reference for migration is this Niphlod post but in this case I don't >> know how to found a solution: >> 1. Put your models exactly has the database tables are. >> 2. Do a fake migrate. >> 3. Remove fake migrate and set migrate=True >> 4. Do the changes you need in your model. >> >> What happens if you set migrate=False in the table definition ? the >> check between the model in db.py and the .table file is skipped, and >> web2py assumes that on the db the table reflect exactly what there is in >> the model >> >> What happens if you set fake_migrate=True in the table definition ? >> web2py assumes that on the db the table reflect exactly what there is in >> the model, the .table files are recreated >> >> What happens if you set fake_migrate_all=True in the DAL ? all .table >> files are recreated, and web2py assumes that on the db the db tables are >> reflecting the model. >> >> What happens if you set migrate=False in the DAL? whatever table has no >> a specific "migrate" parameter, the migrate=False is applied to every >> table >> >> This kind of errors can happen only if you messed with this logic, e.g. >> db.define_table('test', Field('test1'), migrate=True) #web2py create the >> test table with the columns id and test1 >> >> then >> db.define_table('test', Field('test1'), Field('test2'), migrate=False, >> fake_migrate=True) # web2py assumes that you created manually on the db >> the column test2, and updates the .table file >> >> then >> db.define_table('test', Field('test1'), Field('test2')) # web2py sees no >> change between the .table file and the model, but if there's not the column >> on the db, when you try to use it you'll get the "no such column" error >> >> then you delete the 'test' .table file manually, then >> db.define_table('test', Field('test1'), Field('test2'), migrate=True) >> #web2py >> assumes that the 'test' table is not on the db, because the corresponding >> .table file is not there, so it tries to create it, and you get the error >> "table 'test' already exists on the db" >> >> or, you delete the 'test' .table file manually, and drop the table >> manually on the db then >> db.define_table('test', Field('test1'), migrate=False) #web2py assumes >> that the table is already there, and when you try to use it you get the >> error "table 'test' does not exist" >> >> >> Someone knows how can I resolve it ? >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.