aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2012-12-09 19:50:33 +0100
committerChristopher Allan Webber <cwebber@dustycloud.org>2012-12-10 16:17:24 -0600
commitea91c183ff8c6c877d3403f354c92b18a3788860 (patch)
tree8d47a871024831111d257d503b976ebfd6bbfb5a
parent0f14c362c33408d4642372392fa56353946d5cdc (diff)
downloadmediagoblin-ea91c183ff8c6c877d3403f354c92b18a3788860.tar.lz
mediagoblin-ea91c183ff8c6c877d3403f354c92b18a3788860.tar.xz
mediagoblin-ea91c183ff8c6c877d3403f354c92b18a3788860.zip
UniqueConstraing migration: Adding the explaining comments.
Add a lengthy comment explaining all the variants.
-rw-r--r--mediagoblin/db/sql/migrations.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/mediagoblin/db/sql/migrations.py b/mediagoblin/db/sql/migrations.py
index 274843ff..66557912 100644
--- a/mediagoblin/db/sql/migrations.py
+++ b/mediagoblin/db/sql/migrations.py
@@ -136,6 +136,29 @@ def create_processing_metadata_table(db):
ProcessingMetaData_v0.__table__.create(db.bind)
db.commit()
+
+# Okay, problem being:
+# Migration #4 forgot to add the uniqueconstraint for the
+# new tables. While creating the tables from scratch had
+# the constraint enabled.
+#
+# So we have three situations that should end up at the same
+# db layout:
+#
+# 1. Fresh install.
+# Well, easy. Just uses the tables in models.py
+# 2. Fresh install using a git version just before this migration
+# The tables are all there, the unique constraint is also there.
+# This migration should do nothing.
+# But as we can't detect the uniqueconstraint easily,
+# this migration just adds the constraint again.
+# And possibly fails very loud. But ignores the failure.
+# 3. old install, not using git, just releases.
+# This one will get the new tables in #4 (now with constraint!)
+# And this migration is just skipped silently.
+# 4. old install, always on latest git.
+# This one has the tables, but lacks the constraint.
+# So this mitration adds the constraint.
@RegisterMigration(7, MIGRATIONS)
def fix_CollectionItem_v0_constraint(db_conn):
"""Add the forgotten Constraint on CollectionItem"""