connection is not close in migration script

close the connection in migration script 021.
also close connection earlier.

Closes-Bug: #1255173
Change-Id: I27dab9bb08a5f9038d6a5fc1267c5a749b703a61
This commit is contained in:
Gordon Chung 2013-11-26 12:24:05 -05:00
parent a2f80f2a19
commit 77dad15297

View File

@ -47,6 +47,7 @@ def upgrade(migrate_engine):
"ON event.unique_name_id = unique_name.id " "ON event.unique_name_id = unique_name.id "
"GROUP BY unique_name.id") "GROUP BY unique_name.id")
conn.execute(sql) conn.execute(sql)
conn.close()
# Now we need to drop the foreign key constraint, rename # Now we need to drop the foreign key constraint, rename
# the event.unique_name column, and re-add a new foreign # the event.unique_name column, and re-add a new foreign
# key constraint # key constraint
@ -76,7 +77,6 @@ def upgrade(migrate_engine):
fkey.create() fkey.create()
event.c.unique_name_id.drop() event.c.unique_name_id.drop()
conn.close()
def downgrade(migrate_engine): def downgrade(migrate_engine):
@ -90,6 +90,7 @@ def downgrade(migrate_engine):
sql = ("INSERT INTO unique_name " sql = ("INSERT INTO unique_name "
"SELECT event_type.id, event_type.desc FROM event_type") "SELECT event_type.id, event_type.desc FROM event_type")
conn.execute(sql) conn.execute(sql)
conn.close()
# Drop the foreign key constraint to event_type, drop the # Drop the foreign key constraint to event_type, drop the
# event_type table, rename the event.event_type column to # event_type table, rename the event.event_type column to
# event.unique_name, and re-add the old foreign # event.unique_name, and re-add the old foreign