Creating table on the fly with the app in production

32 views
Skip to first unread message

Gualter Portella

unread,
Mar 8, 2019, 5:04:02 PM3/8/19
to web2py-users
Hi everyone,
My app is in production and is hosted at RoseHosting.
I will soon need to create several tables and want to avoid those “auth.user table has already been created” messages when the app crashes as I insert new code on, for example, db.py.
I will insert code like this, simple stuff:
db.define_table(‘sometsble’, Field(‘somefield’, ‘string’, notnull=True))
My question is:
Are there step by step explanations available on how to do it without much try and error puzzles?
Did not find anything really clear on this matter either on web2py manual or on the web.
Any suggestions or help?
Many thanks.
Gualter

Leonel Câmara

unread,
Mar 8, 2019, 5:58:23 PM3/8/19
to web2py-users
The simple stuff you talk about should simply work:

0. backup the database, this is just good practice...
1. if you're running the scheduler you should stop it until migration is finished and migrate is disabled
2. update the code making sure migrate is True.
3. visit appadmin to make sure all tables migrated even if they're lazy
4. disable migrations
5. restart scheduler

We should probably have a command line to do 2,3 and 4...

Gualter Portella

unread,
Mar 8, 2019, 7:04:41 PM3/8/19
to web...@googlegroups.com
Thanks, Leonel! I will try it out tomorrow. 
Cheers 

Enviado do meu iPhone
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/QppWmXa4iSY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages