try define_table(....,migrate=True,fake_migrate=True)
On Sep 13, 4:56 am, vortex <[email protected]> wrote: > It says: > InternalError: (1050, u"Table 'app_version' already exists") > > When migrate=True. And it is true. I don't want it to recreate > anything. What does web2py detect here? that tables are different > from .table file? Should I delete .table files? > > On Sep 9, 2:34 pm, Massimo Di Pierro <[email protected]> > wrote: > > > > > > > > > If web2py tries to create it then it does not know it exist. If you do > > know and web2py does not know it means something is wrong with the > > database metadata and needs rebuilding. You can do > > > db.define_tables(...,migrate=True,fake_migrate=True) > > > to rebuild metadata. Once done, remove the fake_migrate option. > > > On Sep 9, 4:19 am,vortex<[email protected]> wrote: > > > > What should be the definition so that web2py only alters the mysql > > > table to correspond to the new definition but if it exists not to > > > create it. > > > > db_server.define_table('db_version', > > > Field('major', 'integer', default = 0), > > > Field('minor', 'integer', default = 0), > > > migrate= True, > > > ) > > > > Or at least never to create the table but alter it if needed.

