binding migration metadata to engine, and level_exits_new_table should now work
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 15 Jan 2012 21:43:59 +0000 (15:43 -0600)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 29 Jan 2012 22:33:46 +0000 (16:33 -0600)
mediagoblin/tests/test_sql_migrations.py

index 0f1f02bd32cde044c6ae4df40bede76a57c6b4ed..ba9e967a1a548f245f84810ee8c6f2dc48af6b45 100644 (file)
@@ -102,16 +102,16 @@ SET2_MODELS = [Creature2, CreaturePower2, Level2, LevelExit2]
 
 @RegisterMigration(1, FULL_MIGRATIONS)
 def creature_remove_is_demon(db_conn):
+    metadata = MetaData(bind=db_conn.engine)
     creature_table = Table(
-        'creature', MetaData(),
+        'creature', metadata,
         autoload=True, autoload_with=db_conn.engine)
-    db_conn.execute(
-        creature_table.drop_column('is_demon'))
+    creature_table.drop_column('is_demon')
     
 
 @RegisterMigration(2, FULL_MIGRATIONS)
 def creature_powers_new_table(db_conn):
-    metadata = MetaData()
+    metadata = MetaData(bind=db_conn.engine)
     creature_powers = Table(
         'creature_power', metadata,
         Column('id', Integer, primary_key=True),
@@ -127,7 +127,7 @@ def creature_powers_new_table(db_conn):
 def level_exits_new_table(db_conn):
     # First, create the table
     # -----------------------
-    metadata = MetaData()
+    metadata = MetaData(bind=db_conn.engine)
     level_exits = Table(
         'level_exit', metadata,
         Column('id', Integer, primary_key=True),
@@ -165,7 +165,7 @@ def level_exits_new_table(db_conn):
 
     # Finally, drop the old level exits pickle table
     # ----------------------------------------------
-    
+    levels.drop_column('exits')    
 
 
 # A hack!  At this point we freeze-fame and get just a partial list of