I would add to make a backup copy of the databases folder under your app. then delete the databases folder content, put db(...., fake_migrate_all=True) python web2py.py -M -S <your app> [you can exit from the python shell then]
If you keep having troubles you must have some problem in the table related to foreign keys, see: https://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html """If MySQL reports an error number 1005 from a CREATE TABLE statement, and the error message refers to error 150, table creation failed because a foreign key constraint was not correctly formed. Similarly, if an ALTER TABLE fails and it refers to error 150, that means a foreign key definition would be incorrectly formed for the altered table. To display a detailed explanation of the most recent InnoDB foreign key error in the server, issue SHOW ENGINE INNODB STATUS. Important""" mic 2012/5/8 Johann Spies <[email protected]>: > On 8 May 2012 07:17, Yarin <[email protected]> wrote: >> >> >> I understand that the db definitions may be corrupted from time to time, >> even though in this case I see no reason why they should have been. But my >> real concern is that there's no process I can fall back on to rebuild the >> definitions from scratch. Please help me with this. > > > What is happening in the database itself: Can you browse the data in mysql > outside web2py? > > If so, you can try the following: > > * Backup your mysql database (mysqldump) > * Export the mysql-data to csv-file(s). > * Drop the tables > * Fix your models. > * delete all the files in web2py/applications<yourapp>/databases > * start the app again (try "python web2py.py -M -N -S <yourapp>"). This > will recreate the tables. > * from appadmin: export the empty tables to get the correct csv-file > headings. > * adapt your previously exported csv-files to fit the exported headings. > * try and import it. > > Regards > Johann > -- > Because experiencing your loyal love is better than life itself, > my lips will praise you. (Psalm 63:3) >

