Fix migration

(grafted from 2752760f3dbda217cf75646618de283745c4ecc4)
This commit is contained in:
Sergi Almacellas Abellana 2015-12-24 10:18:53 +01:00
parent 13edeed73f
commit a1136989bf
1 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import ssl
import sql
from sql import Column
import xmlrpclib
from datetime import datetime
from datetime import datetime, timedelta
import random
import string
import hashlib
@ -117,12 +117,12 @@ class Scheduler(ModelSQL, ModelView):
super(Scheduler, cls).__register__(module_name)
for field in ('normal_check', 'retry_check'):
old_field = '%s_interval'
old_field = '%s_interval' % field
if table.column_exist(old_field):
cursor.execute(*sql_table.select(
sql_table.id, Column(sql_table, old_field)))
for id_, hours in cursor.fetchall():
new_value = datetime.timedelta(hours=hours)
new_value = timedelta(hours=hours)
cursor.execute(*sql_table.update(
[Column(sql_table, field)],
[new_value],