Table Migration on GAE

52 views
Skip to first unread message

Sébastien Loix

unread,
Mar 23, 2015, 10:53:04 PM3/23/15
to web...@googlegroups.com
Hi,

I am having difficulties with table migration on GAE.

I deployed perfectly in the Google App Engine and everything is working fine.

I then needed to make some change in the auth_user adding some extra field but when I deploy again the new version, the migration doesn't occur and the new column is not created.

Here is the code used:

db = DAL('google:sql://[app-name]:[db-name]/[table-name]', migrate_enabled=True, check_reserved=['all'], lazy_tables=True)

then below:

auth.settings.extra_fields['auth_user'] = [Field('username_fb', length=128, default="", unique=True, writable=False, readable=False)]
auth.define_tables(username=False, signature=False, migrate=True)

Any idea why the migration doesn't occur?

Is there a way to force web2py to do migration somehow?

Thanks for the help!
Best,
Sebastian

Massimo Di Pierro

unread,
Mar 24, 2015, 3:31:51 AM3/24/15
to web...@googlegroups.com
1) there are no migrations on GAE, web2py will still create .table files but they serve no purpose.
2) GAE support is broken in 2.9.12. It works in trunk pydal and we will released a fixed version this week

Sébastien Loix

unread,
Mar 24, 2015, 12:18:06 PM3/24/15
to web...@googlegroups.com
Thank you for the answer.
Could you explain a bit more the "there are no migrations on GAE", is it only for the actual version and the fixed version will solve it?
I realised that I am using the 2.10.0-beta version of web2py. The one downloaded from the main download page.
Thanks for the help

Massimo Di Pierro

unread,
Mar 24, 2015, 12:32:09 PM3/24/15
to web...@googlegroups.com
I spoke too soon. Please wait I post a new version for testers. I will email this list.
Then try:

db = DAL('google:sql://[app-name]:[db-name]/[table-name]')
...
auth.settings.extra_fields['auth_user'] = [Field('username_fb', length=128, default="", unique=True, writable=False, readable=False)]
auth.define_tables(username=False, signature=False)

consider that migrate_enabled is true by default so no need to set it. Also the check_reserved keywords is designed for SQL and not GAE. It does not hurt but it is not necessary. I do not swear by lazy_table because they have some caveats. Let's try without that.

Can you help us check if this work? If, not what behaviour do you see? Do you get a traceback?

Sébastien Loix

unread,
Mar 28, 2015, 12:14:44 PM3/28/15
to web...@googlegroups.com
Hello Massimo,
Where can I find the version for tester?
Also I am using SQL with MySQL with GAE through Cloud SQL, so the check_reserved keywords is necessary right?

Once I have the new version I will test it and report here.
Thanks

Massimo Di Pierro

unread,
Mar 28, 2015, 12:29:24 PM3/28/15
to web...@googlegroups.com

Sébastien Loix

unread,
Mar 31, 2015, 6:27:11 PM3/31/15
to web...@googlegroups.com
I just downloaded and tested the latest source for testers on GAE.

Migration does work perfectly for the tables inside the models but still does not work for the "auth.settings.extra_fields['auth_user'] = (...Fields)"
It is no big deal for me as I have installed phpMyAdmin (as an app version) and manually created the extra field for auth_user table but just so you know it.

Thanks for the update!
Reply all
Reply to author
Forward
0 new messages