Only run archivalook migration if the tables aren't there.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 12 Mar 2016 23:46:02 +0000 (15:46 -0800)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 26 Mar 2016 18:39:08 +0000 (11:39 -0700)
Standard for anything existing before the Alembic move-over, but I
forgot this one.

* mediagoblin/plugins/archivalook/migrations/b10b5f822789_archivalook_plugin_initial_migration.py
  (upgrade): Add has_table check, skip if such a table already exists.

mediagoblin/plugins/archivalook/migrations/b10b5f822789_archivalook_plugin_initial_migration.py

index 0dfa2ac1bb4b7ecaf9f2e2fd64acc2e07fff40f7..1bedcf3c17e35192bb54c81a7acd191397b754dc 100644 (file)
@@ -17,6 +17,11 @@ import sqlalchemy as sa
 
 
 def upgrade():
+    if op.get_bind().engine.has_table('archivalook__featured_media'):
+        # Skip; this has already been instantiated
+        # (probably via sqlalchemy-migrate)
+        return
+
     op.create_table(
         'archivalook__featured_media',
         sa.Column('id', sa.Integer(), nullable=False),