summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2010-11-20 03:08:50 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2010-11-20 03:08:50 +0100
commit2ab22e70f9b9892ec49393512261e08c3350747d (patch)
tree18f7a1f5898b14b4d3287780c0d7d83d10191513
parent00697996e885044314cc297b72aaa86d69d2a219 (diff)
downloadChimère-2ab22e70f9b9892ec49393512261e08c3350747d.tar.bz2
Chimère-2ab22e70f9b9892ec49393512261e08c3350747d.zip
Correction on the upgrade script: change of the order to make it
possible
-rwxr-xr-xchimere/scripts/upgrade.py53
1 files changed, 26 insertions, 27 deletions
diff --git a/chimere/scripts/upgrade.py b/chimere/scripts/upgrade.py
index 46b3548..a5e316f 100755
--- a/chimere/scripts/upgrade.py
+++ b/chimere/scripts/upgrade.py
@@ -162,33 +162,6 @@ for area in areas:
if changed:
print " * projections of areas corrected"
-# changement from version 1.0 to 1.1: version of django 1.2
-# create specific height and width for image fields
-
-for cls, attr in ((Icon, "image"), (Marker, "picture"),
- (Route, "picture")):
- table = cls._meta.db_table
- query = QUERY_CHECK_FIELD % (table, 'width')
- cursor.execute(query)
- transaction.commit_unless_managed()
-
- row = cursor.fetchone()
- if not row:
- query_update = "ALTER TABLE "+table+" ADD COLUMN width integer"
- cursor.execute(query_update)
- transaction.commit_unless_managed()
- query_update = "ALTER TABLE "+table+" ADD COLUMN height integer"
- cursor.execute(query_update)
- transaction.commit_unless_managed()
- for obj in cls.objects.all():
- image = getattr(obj, attr)
- if not image:
- continue
- obj.width = image.width
- obj.height = image.height
- obj.save()
- print " * height and width of " + table + " corrected"
-
# changement from version 1.0 to 1.1: add dated fields to markers and routes
if settings.DAYS_BEFORE_EVENT:
for cls in (Marker, Route):
@@ -223,6 +196,32 @@ available_date timestamp with time zone"
transaction.commit_unless_managed()
print " * available_date added to table " + table + "."
+# changement from version 1.0 to 1.1: version of django 1.2
+# create specific height and width for image fields
+
+for cls, attr in ((Icon, "image"), (Marker, "picture"),
+ (Route, "picture")):
+ table = cls._meta.db_table
+ query = QUERY_CHECK_FIELD % (table, 'width')
+ cursor.execute(query)
+ transaction.commit_unless_managed()
+
+ row = cursor.fetchone()
+ if not row:
+ query_update = "ALTER TABLE "+table+" ADD COLUMN width integer"
+ cursor.execute(query_update)
+ transaction.commit_unless_managed()
+ query_update = "ALTER TABLE "+table+" ADD COLUMN height integer"
+ cursor.execute(query_update)
+ transaction.commit_unless_managed()
+ for obj in cls.objects.all():
+ image = getattr(obj, attr)
+ if not image:
+ continue
+ obj.width = image.width
+ obj.height = image.height
+ obj.save()
+ print " * height and width of " + table + " corrected"
# changement from version 1.0 to 1.1: multiple selection of categories