diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2010-11-18 22:50:17 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2010-11-18 22:50:17 +0100 |
commit | 52b79196688dacf5a7874db254bbd9b9748d8ee3 (patch) | |
tree | 2161cf6d3a85716f6920e40aac893f9f5d0ce893 /chimere/scripts/upgrade.py | |
parent | b418a3977cabb6df34099c06f3b8ea563bc9c964 (diff) | |
download | Chimère-52b79196688dacf5a7874db254bbd9b9748d8ee3.tar.bz2 Chimère-52b79196688dacf5a7874db254bbd9b9748d8ee3.zip |
Make the management of dated object optionnal (refs #270)
Diffstat (limited to 'chimere/scripts/upgrade.py')
-rwxr-xr-x | chimere/scripts/upgrade.py | 30 |
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 |