cubicweb/misc/migration/3.22.0_Any.py
changeset 11057 0b59724cb3f2
parent 11033 63d860a14a17
child 11129 97095348b3ee
equal deleted inserted replaced
11052:058bb3dc685f 11057:0b59724cb3f2
       
     1 if confirm('use Europe/Paris as timezone?'):
       
     2     timezone = 'Europe/Paris'
       
     3 else:
       
     4     import pytz
       
     5     while True:
       
     6         timezone = raw_input('enter your timezone')
       
     7         if timezone in pytz.common_timezones:
       
     8             break
       
     9 
       
    10 dbdriver = repo.system_source.dbdriver
       
    11 if dbdriver == 'postgres':
       
    12     sql("SET TIME ZONE '%s'" % timezone)
       
    13 
       
    14 for entity in schema.entities():
       
    15     if entity.final:
       
    16         continue
       
    17     change_attribute_type(entity.type, 'creation_date', 'TZDatetime', ask_confirm=False)
       
    18     change_attribute_type(entity.type, 'modification_date', 'TZDatetime', ask_confirm=False)
       
    19 
       
    20 if dbdriver == 'postgres':
       
    21     sql("SET TIME ZONE UTC")