misc/migration/3.22.0_Any.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 12 Feb 2016 15:31:48 +0100
changeset 11112 d0d86803a804
parent 11101 66fb68c25f83
permissions -rw-r--r--
fix test broken by #012e6c7d02ef

if confirm('use Europe/Paris as timezone?'):
    timezone = 'Europe/Paris'
else:
    import pytz
    while True:
        timezone = raw_input('enter your timezone')
        if timezone in pytz.common_timezones:
            break

dbdriver = repo.system_source.dbdriver
if dbdriver == 'postgres':
    sql("SET TIME ZONE '%s'" % timezone)

for entity in schema.entities():
    if entity.final or entity.type not in fsschema:
        continue
    change_attribute_type(entity.type, 'creation_date', 'TZDatetime', ask_confirm=False)
    change_attribute_type(entity.type, 'modification_date', 'TZDatetime', ask_confirm=False)

if dbdriver == 'postgres':
    sql("SET TIME ZONE UTC")