diff options
Diffstat (limited to 'chimere/scripts')
| -rwxr-xr-x | chimere/scripts/upgrade.py | 19 | 
1 files changed, 19 insertions, 0 deletions
| diff --git a/chimere/scripts/upgrade.py b/chimere/scripts/upgrade.py index 4c1cdc0..bd6e46e 100755 --- a/chimere/scripts/upgrade.py +++ b/chimere/scripts/upgrade.py @@ -188,6 +188,25 @@ for cls, attr in ((Icon, "image"), (Marker, "picture"),              obj.save()          print " * height and width of " + table + " corrected" +# changement from version 1.0 to 1.1: add dated fields to markers and routes + +for cls in (Marker, Route): +    table = cls._meta.db_table +    query = QUERY_CHECK_FIELD % (table, 'start_date') +    cursor.execute(query) +    transaction.commit_unless_managed() + +    row = cursor.fetchone() +    if not row: +        query_update = "ALTER TABLE "+table+" ADD COLUMN start_date date" +        cursor.execute(query_update) +        transaction.commit_unless_managed() +        query_update = "ALTER TABLE "+table+" ADD COLUMN end_date date" +        cursor.execute(query_update) +        transaction.commit_unless_managed() +        print " * start_date and end_date added to table " + table + "." + +  # changement from version 1.0 to 1.1: multiple selection of categories  for cls in (Marker, Route): | 
