summaryrefslogtreecommitdiff
path: root/chimere/scripts/upgrade.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2010-11-19 20:34:08 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2010-11-19 20:34:08 +0100
commitdf7280ea8573db04f496cb3dea4f693d3fd782a5 (patch)
tree12ab13a5e7f25f7094ed052933a67e1fb7901e2d /chimere/scripts/upgrade.py
parent3ef851560d273150565e067e4288e7348e14086b (diff)
downloadChimère-df7280ea8573db04f496cb3dea4f693d3fd782a5.tar.bz2
Chimère-df7280ea8573db04f496cb3dea4f693d3fd782a5.zip
Update of upgrade script for available_date field (refs #65)
Diffstat (limited to 'chimere/scripts/upgrade.py')
-rwxr-xr-xchimere/scripts/upgrade.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/chimere/scripts/upgrade.py b/chimere/scripts/upgrade.py
index 8f5c65a..46b3548 100755
--- a/chimere/scripts/upgrade.py
+++ b/chimere/scripts/upgrade.py
@@ -95,7 +95,8 @@ if not row:
row = cursor.fetchone()
if row:
- query_rename = """ALTER TABLE subcategory_areas RENAME TO main_subcategory_areas;"""
+ query_rename = "ALTER TABLE subcategory_areas RENAME TO \
+main_subcategory_areas;"
cursor.execute(query_rename)
transaction.commit_unless_managed()
print " * subcategory_areas renamed to main_subcategory_areas"
@@ -206,6 +207,22 @@ if settings.DAYS_BEFORE_EVENT:
transaction.commit_unless_managed()
print " * start_date and end_date added to table " + table + "."
+# changement from version 1.0 to 1.1: add available_date field to marker
+if 'chimere.rss' in settings.INSTALLED_APPS:
+ for cls in (Marker,):
+ table = cls._meta.db_table
+ query = QUERY_CHECK_FIELD % (table, 'available_date')
+ cursor.execute(query)
+ transaction.commit_unless_managed()
+
+ row = cursor.fetchone()
+ if not row:
+ query_update = "ALTER TABLE " + table + " ADD COLUMN \
+available_date timestamp with time zone"
+ cursor.execute(query_update)
+ transaction.commit_unless_managed()
+ print " * available_date added to table " + table + "."
+
# changement from version 1.0 to 1.1: multiple selection of categories