migration type mismatch

35 views
Skip to first unread message

goome

unread,
May 21, 2015, 1:39:00 PM5/21/15
to web...@googlegroups.com
from the book :"define_table checks whether or not the corresponding table exists. If it does not, it generates the SQL to create it and executes the SQL. If the table does exist but differs from the one being defined, it generates the SQL to alter the table and executes it. If a field has changed type but not name, it will try to convert the data"
So  i suppose that this could help me in cleaning data (from type mismatch).
i copied the current project(application) in a new one, leaving in the dir 'databases' only the sqlite storage.
But when i open the home page od this copied app, i got 'table already exists'.
In models/db.py there are no migrate setting , except for auth table, where i set it to migrate=False, as this seems necessary.
Why web2py does not alter(if needed) the table, and instead complains of already existing one?

Anthony

unread,
May 21, 2015, 2:16:01 PM5/21/15
to web...@googlegroups.com, marc...@gmail.com
You didn't turn off migrations in the new app, so web2py thinks it needs to create the table. If you want the new app to control the migrations, you'll have to run one fake migrate so the new app will have a record of the current state of the database.

Anthony

goome

unread,
May 25, 2015, 11:40:44 AM5/25/15
to web...@googlegroups.com, marc...@gmail.com
Thank you very much for your help. Sadly, it did not work.

Anthony

unread,
May 25, 2015, 4:51:00 PM5/25/15
to web...@googlegroups.com, marc...@gmail.com
Hard to say without knowing more details of the code, the content in the database, etc.
Reply all
Reply to author
Forward
0 new messages