summaryrefslogtreecommitdiff
path: root/chimere/scripts/upgrade.py
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/scripts/upgrade.py')
-rwxr-xr-xchimere/scripts/upgrade.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/chimere/scripts/upgrade.py b/chimere/scripts/upgrade.py
index bd6e46e..8f5c65a 100755
--- a/chimere/scripts/upgrade.py
+++ b/chimere/scripts/upgrade.py
@@ -189,22 +189,22 @@ for cls, attr in ((Icon, "image"), (Marker, "picture"),
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)
+if settings.DAYS_BEFORE_EVENT:
+ for cls in (Marker, Route):
+ table = cls._meta.db_table
+ query = QUERY_CHECK_FIELD % (table, 'start_date')
+ cursor.execute(query)
transaction.commit_unless_managed()
- print " * start_date and end_date added to table " + table + "."
+
+ 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