]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Drop service* tables only if they exist
authorJakub Libosvar <libosvar@redhat.com>
Mon, 27 Jan 2014 18:20:51 +0000 (19:20 +0100)
committerJakub Libosvar <libosvar@redhat.com>
Tue, 22 Apr 2014 10:05:15 +0000 (12:05 +0200)
Tables servicedefinitions and servicetypes are not used by neutron but
created using db migration tool. If quantum-server in grizzly was
started without using migration tool then tables mentioned above are not
created. During migration from grizzly to havana alembic attempts to
drop these unused tables. This patch uses "IF EXISTS" clause when
dropping mentioned tables.

Closes-bug: #1273355
Change-Id: I33fcb3e1dc96ce37ec9c00987cb5a3a953ca691d

neutron/db/migration/alembic_migrations/versions/557edfc53098_new_service_types.py

index 17492afc8420fdf2fa6647b301f32ad08477f81d..81fe08b3276111ee4916c3a4e8f287b8a70afebf 100644 (file)
@@ -50,9 +50,8 @@ def upgrade(active_plugins=None, options=None):
                   nullable=False, unique=True),
     )
 
-    # dropping unused tables
-    op.drop_table('servicedefinitions')
-    op.drop_table('servicetypes')
+    for table in ('servicedefinitions', 'servicetypes'):
+        op.execute("DROP TABLE IF EXISTS %s" % table)
 
 
 def downgrade(active_plugins=None, options=None):