How to force an update to the scheduler schema

61 views
Skip to first unread message

Brad Miller

unread,
May 23, 2017, 8:30:08 AM5/23/17
to web2py-users
Due to a forced migration to new hardware/os on webfaction,  I just recently had to upgrade from 2.5.1 to 2.14.6.

In the process I have managed to get myself into a state where the scheduler schema is wrong.  (I'm using postgresql)

I get the following error:

ProgrammingError: ('ERROR', '42703', 'column "prevent_drift" of relation "scheduler_task" does not exist')


This is probably my fault as in my haste to get everything up and live again I did a fake_migrate_all=True (the app was crashing because it said the session table already existed.)


I have all my application tables prefixed with my app name for migration purposes:

runestone_my_table.table. for example.  however the scheduler and the session tables are still getting the default:

033e652b5c024094757cfc1050e7ecda_scheduler_run.table
033e652b5c024094757cfc1050e7ecda_scheduler_task.table
033e652b5c024094757cfc1050e7ecda_scheduler_worker.table
409096731cda32e62dcf6bbed574f3d5_web2py_session_runestone.table

Everything except my scheduler processes is back on line.  Is there any way to make the scheduler update its schema given the state I am in??

Thanks

Brad


Dave S

unread,
May 23, 2017, 2:03:13 PM5/23/17
to web...@googlegroups.com


I think you want to set "migrate" (not "fake_migrate" this time) to true, do one access to any function in your app, and then turn "migrate" off again.

Setting the "fake_migrate" updated your table files (the web2py side of the pipe), but now you need to update the actual DB tables.

If you've got the appconfig.ini set up (as part of your upgrade), then that's easy to do, but it's not much harder if you have to set it in your model.


/dps


/dps

Brad Miller

unread,
May 24, 2017, 4:01:14 PM5/24/17
to web2py-users
Thanks, that would have been easier.

What I ended up doing was dropping the tables and removing the table files.  

then a restart got everything back in sync again.  That only worked because I didn't need to keep any of the data in the scheduler tables.

Brad

Dave S

unread,
May 24, 2017, 4:19:59 PM5/24/17
to web2py-users


On Wednesday, May 24, 2017 at 1:01:14 PM UTC-7, Brad Miller wrote:
Thanks, that would have been easier.

What I ended up doing was dropping the tables and removing the table files.  

then a restart got everything back in sync again.  That only worked because I didn't need to keep any of the data in the scheduler tables.

Brad


At least you're able to move forward now.

 /dps

Ur. Kr.

unread,
Jul 25, 2018, 1:29:12 PM7/25/18
to web2py-users
scheduler = Scheduler(db, migrate=True)
Doesn't recreate tables for me when I rerun the scheduler. 
Reply all
Reply to author
Forward
0 new messages