]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Merge the 2 Alembic migration patches into a single one.
authorThomas Goirand <thomas@goirand.fr>
Mon, 7 Apr 2014 14:27:24 +0000 (22:27 +0800)
committerThomas Goirand <thomas@goirand.fr>
Mon, 7 Apr 2014 14:27:24 +0000 (22:27 +0800)
Change-Id: Ia312c97c1b443bcd5df3ff5824d9a70f2dab0abb

Rewritten-From: 6081c836466cc397518c512447359b0ba89eae2e

trusty/debian/patches/fix-alembic-migration-with-sqlite3.patch
trusty/debian/patches/fixes-more-migration-issues-with-sqlite.patch [deleted file]
trusty/debian/patches/series

index 2897d816d2df73643a9521f28d67747f874987fd..12315a944cecf14c328b328991b5919c157f0858 100644 (file)
@@ -108,4 +108,229 @@ Index: neutron/neutron/db/migration/alembic_migrations/versions/f9263d6df56_remo
 +        op.drop_column('ipallocations', u'expiration')
  
  
+ def downgrade(active_plugins=None, options=None):
+--- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/35c7c198ddea_lbaas_healthmon_del_status.py
++++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/35c7c198ddea_lbaas_healthmon_del_status.py
+@@ -43,8 +43,48 @@ from neutron.db import migration
+ def upgrade(active_plugins=None, options=None):
+     if not migration.should_run(active_plugins, migration_for_plugins):
+         return
+-    op.drop_column('healthmonitors', 'status')
+-    op.drop_column('healthmonitors', 'status_description')
++    bind = op.get_bind()
++    engine = bind.engine
++    if engine.name == 'sqlite':
++        op.execute("CREATE TEMPORARY TABLE healthmonitors_backup ( "
++                   "tenant_id VARCHAR(255),  "
++                   "id VARCHAR(36) NOT NULL, "
++                   "type VARCHAR(5) NOT NULL, "
++                   "delay INTEGER NOT NULL, "
++                   "timeout INTEGER NOT NULL, "
++                   "max_retries INTEGER NOT NULL, "
++                   "http_method VARCHAR(16), "
++                   "url_path VARCHAR(255), "
++                   "expected_codes VARCHAR(64), "
++                   "admin_state_up BOOLEAN NOT NULL, "
++                   "PRIMARY KEY (id), "
++                   "CONSTRAINT healthmontiors_type CHECK (type IN ('PING', 'TCP', 'HTTP', 'HTTPS')), "
++                   "CHECK (admin_state_up IN (0, 1)));")
++        op.execute("INSERT INTO healthmonitors_backup SELECT "
++                   "tenant_id,id,type,delay,timeout,max_retries,http_method,url_path,expected_codes,admin_state_up "
++                   "FROM healthmonitors;")
++        op.execute("DROP TABLE healthmonitors;");
++        op.execute("CREATE TEMPORARY TABLE healthmonitors ( "
++                   "tenant_id VARCHAR(255),  "
++                   "id VARCHAR(36) NOT NULL, "
++                   "type VARCHAR(5) NOT NULL, "
++                   "delay INTEGER NOT NULL, "
++                   "timeout INTEGER NOT NULL, "
++                   "max_retries INTEGER NOT NULL, "
++                   "http_method VARCHAR(16), "
++                   "url_path VARCHAR(255), "
++                   "expected_codes VARCHAR(64), "
++                   "admin_state_up BOOLEAN NOT NULL, "
++                   "PRIMARY KEY (id), "
++                   "CONSTRAINT healthmontiors_type CHECK (type IN ('PING', 'TCP', 'HTTP', 'HTTPS')), "
++                   "CHECK (admin_state_up IN (0, 1)));")
++        op.execute("INSERT INTO healthmonitors SELECT "
++                   "tenant_id,id,type,delay,timeout,max_retries,http_method,url_path,expected_codes,admin_state_up "
++                   "FROM healthmonitors_backup;")
++        op.execute("DROP TABLE healthmonitors_backup;");
++    else:
++        op.drop_column('healthmonitors', 'status')
++        op.drop_column('healthmonitors', 'status_description')
+ def downgrade(active_plugins=None, options=None):
+--- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/50d5ba354c23_ml2_binding_vif_details.py
++++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/50d5ba354c23_ml2_binding_vif_details.py
+@@ -44,17 +44,58 @@ def upgrade(active_plugins=None, options
+     if not migration.should_run(active_plugins, migration_for_plugins):
+         return
+-    op.add_column('ml2_port_bindings',
+-                  sa.Column('vif_details', sa.String(length=4095),
+-                            nullable=False, server_default=''))
+-    migr_context = context.get_context()
+-    with context.begin_transaction():
++    bind = op.get_bind()
++    engine = bind.engine
++    if engine.name == 'sqlite':
++        op.execute("CREATE TEMPORARY TABLE ml2_port_bindings_backup ( "
++                   "port_id VARCHAR(36) NOT NULL, "
++                   "host VARCHAR(255) NOT NULL, "
++                   "vif_type VARCHAR(64) NOT NULL, "
++                   "cap_port_filter BOOLEAN NOT NULL, "
++                   "driver VARCHAR(64), "
++                   "segment VARCHAR(36), "
++                   "vnic_type VARCHAR(64) DEFAULT 'normal' NOT NULL, "
++                   "vif_details VARCHAR(4095) DEFAULT '' NOT NULL, "
++                   "PRIMARY KEY (port_id), "
++                   "FOREIGN KEY(port_id) REFERENCES ports (id) ON DELETE CASCADE, "
++                   "FOREIGN KEY(segment) REFERENCES ml2_network_segments (id) ON DELETE SET NULL, "
++                   "CHECK (cap_port_filter IN (0, 1)));")
++        op.execute("INSERT INTO ml2_port_bindings_backup "
++                   "(port_id,host,vif_type,cap_port_filter,driver,segment,vnic_type) "
++                   "SELECT port_id,host,vif_type,cap_port_filter,driver,segment,vnic_type "
++                   "FROM ml2_port_bindings;")
+         for value in ('true', 'false'):
+-            migr_context.execute(
+-                "UPDATE ml2_port_bindings SET"
+-                " vif_details = '{\"port_filter\": %(value)s}'"
+-                " WHERE cap_port_filter = %(value)s" % {'value': value})
+-    op.drop_column('ml2_port_bindings', 'cap_port_filter')
++            op.execute("UPDATE ml2_port_bindings_backup SET"
++                       " vif_details = '{\"port_filter\": %(value)s}'"
++                       " WHERE cap_port_filter = '%(value)s'" % {'value': value})
++        op.execute("DROP TABLE ml2_port_bindings")
++        op.execute("CREATE TABLE ml2_port_bindings ( "
++                   "port_id VARCHAR(36) NOT NULL, "
++                   "host VARCHAR(255) NOT NULL, "
++                   "vif_type VARCHAR(64) NOT NULL, "
++                   "driver VARCHAR(64), "
++                   "segment VARCHAR(36), "
++                   "vnic_type VARCHAR(64) DEFAULT 'normal' NOT NULL, "
++                   "vif_details VARCHAR(4095) DEFAULT '' NOT NULL, "
++                   "PRIMARY KEY (port_id), "
++                   "FOREIGN KEY(port_id) REFERENCES ports (id) ON DELETE CASCADE, "
++                   "FOREIGN KEY(segment) REFERENCES ml2_network_segments (id) ON DELETE SET NULL);")
++        op.execute("INSERT INTO ml2_port_bindings "
++                   "SELECT port_id,host,vif_type,driver,segment,vnic_type,vif_details "
++                   "FROM ml2_port_bindings_backup;")
++        op.execute("DROP TABLE ml2_port_bindings_backup")
++    else:
++        op.add_column('ml2_port_bindings',
++                      sa.Column('vif_details', sa.String(length=4095),
++                                nullable=False, server_default=''))
++        migr_context = context.get_context()
++        with context.begin_transaction():
++            for value in ('true', 'false'):
++                migr_context.execute(
++                    "UPDATE ml2_port_bindings SET"
++                    " vif_details = '{\"port_filter\": %(value)s}'"
++                    " WHERE cap_port_filter = %(value)s" % {'value': value})
++        op.drop_column('ml2_port_bindings', 'cap_port_filter')
+ def downgrade(active_plugins=None, options=None):
+--- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py
++++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py
+@@ -43,9 +43,15 @@ def upgrade(active_plugins=None, options
+     if not migration.should_run(active_plugins, migration_for_plugins):
+         return
+-    op.add_column('poolmonitorassociations', sa.Column('status',
+-                                                       sa.String(16),
+-                                                       nullable=False))
++    bind = op.get_bind()
++    engine = bind.engine
++    if engine.name == 'sqlite':
++        op.add_column('poolmonitorassociations', sa.Column('status',
++                                                           sa.String(16)))
++    else:
++        op.add_column('poolmonitorassociations', sa.Column('status',
++                                                           sa.String(16),
++                                                           nullable=False))
+     op.add_column('poolmonitorassociations', sa.Column('status_description',
+                                                        sa.String(255)))
+--- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py
++++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py
+@@ -47,11 +47,17 @@ def upgrade(active_plugins=None, options
+     if not migration.should_run(active_plugins, migration_for_plugins):
+         return
+-    op.create_unique_constraint(
+-        name=CONSTRAINT_NAME,
+-        source=TABLE_NAME,
+-        local_cols=['pool_id', 'address', 'protocol_port']
+-    )
++    bind = op.get_bind()
++    engine = bind.engine
++    if engine.name == 'sqlite':
++        op.execute("CREATE UNIQUE INDEX uniq_member0pool_id0address0port "
++                   "on members (pool_id,address,protocol_port);")
++    else:
++        op.create_unique_constraint(
++            name=CONSTRAINT_NAME,
++            source=TABLE_NAME,
++            local_cols=['pool_id', 'address', 'protocol_port']
++        )
+ def downgrade(active_plugins=None, options=None):
+--- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/abc88c33f74f_lb_stats_needs_bigint.py
++++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/abc88c33f74f_lb_stats_needs_bigint.py
+@@ -43,14 +43,19 @@ def upgrade(active_plugins=None, options
+     if not migration.should_run(active_plugins, migration_for_plugins):
+         return
+-    op.alter_column('poolstatisticss', 'bytes_in',
+-                    type_=sa.BigInteger(), existing_type=sa.Integer())
+-    op.alter_column('poolstatisticss', 'bytes_out',
+-                    type_=sa.BigInteger(), existing_type=sa.Integer())
+-    op.alter_column('poolstatisticss', 'active_connections',
+-                    type_=sa.BigInteger(), existing_type=sa.Integer())
+-    op.alter_column('poolstatisticss', 'total_connections',
+-                    type_=sa.BigInteger(), existing_type=sa.Integer())
++    bind = op.get_bind()
++    engine = bind.engine
++    # There's no such thing as "BIGINT" in SQLite, just INTEGER,
++    # so we have nothing to do for SQLite.
++    if engine.name != 'sqlite':
++        op.alter_column('poolstatisticss', 'bytes_in',
++                        type_=sa.BigInteger(), existing_type=sa.Integer())
++        op.alter_column('poolstatisticss', 'bytes_out',
++                        type_=sa.BigInteger(), existing_type=sa.Integer())
++        op.alter_column('poolstatisticss', 'active_connections',
++                        type_=sa.BigInteger(), existing_type=sa.Integer())
++        op.alter_column('poolstatisticss', 'total_connections',
++                        type_=sa.BigInteger(), existing_type=sa.Integer())
+ def downgrade(active_plugins=None, options=None):
+--- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py
++++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py
+@@ -55,11 +55,17 @@ def upgrade(active_plugins=None, options
+     if not migration.should_run(active_plugins, migration_for_plugins):
+         return
+-    op.create_unique_constraint(
+-        name=UC_NAME,
+-        source=TABLE_NAME,
+-        local_cols=['agent_type', 'host']
+-    )
++    bind = op.get_bind()
++    engine = bind.engine
++    if engine.name == 'sqlite':
++        op.execute("CREATE UNIQUE INDEX uniq_agents0agent_type0host "
++                   "on agents (agent_type,host);")
++    else:
++        op.create_unique_constraint(
++            name=UC_NAME,
++            source=TABLE_NAME,
++            local_cols=['agent_type', 'host']
++        )
  def downgrade(active_plugins=None, options=None):
diff --git a/trusty/debian/patches/fixes-more-migration-issues-with-sqlite.patch b/trusty/debian/patches/fixes-more-migration-issues-with-sqlite.patch
deleted file mode 100644 (file)
index 2554ea2..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-Description: More SQLite fixes
- Upstream doesn't support SQLite well enough, when it's really not hard to do
- so correctly, so I've added a couples of corrections.
- .
- Note that despite my repetitive attemps to send the patches upstream, it
- hasn't been received well enough to be accepted, on the pretext that "we do
- not have a clear policy". Well, take your time to decide, in the mean while,
- Debian will embbed this patch! :)
-Author: Thomas Goirand <zigo@debian.org>
-Forwarded: no
-Last-Update: 2014-04-07
-
---- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/35c7c198ddea_lbaas_healthmon_del_status.py
-+++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/35c7c198ddea_lbaas_healthmon_del_status.py
-@@ -43,8 +43,48 @@ from neutron.db import migration
- def upgrade(active_plugins=None, options=None):
-     if not migration.should_run(active_plugins, migration_for_plugins):
-         return
--    op.drop_column('healthmonitors', 'status')
--    op.drop_column('healthmonitors', 'status_description')
-+    bind = op.get_bind()
-+    engine = bind.engine
-+    if engine.name == 'sqlite':
-+        op.execute("CREATE TEMPORARY TABLE healthmonitors_backup ( "
-+                   "tenant_id VARCHAR(255),  "
-+                   "id VARCHAR(36) NOT NULL, "
-+                   "type VARCHAR(5) NOT NULL, "
-+                   "delay INTEGER NOT NULL, "
-+                   "timeout INTEGER NOT NULL, "
-+                   "max_retries INTEGER NOT NULL, "
-+                   "http_method VARCHAR(16), "
-+                   "url_path VARCHAR(255), "
-+                   "expected_codes VARCHAR(64), "
-+                   "admin_state_up BOOLEAN NOT NULL, "
-+                   "PRIMARY KEY (id), "
-+                   "CONSTRAINT healthmontiors_type CHECK (type IN ('PING', 'TCP', 'HTTP', 'HTTPS')), "
-+                   "CHECK (admin_state_up IN (0, 1)));")
-+        op.execute("INSERT INTO healthmonitors_backup SELECT "
-+                   "tenant_id,id,type,delay,timeout,max_retries,http_method,url_path,expected_codes,admin_state_up "
-+                   "FROM healthmonitors;")
-+        op.execute("DROP TABLE healthmonitors;");
-+        op.execute("CREATE TEMPORARY TABLE healthmonitors ( "
-+                   "tenant_id VARCHAR(255),  "
-+                   "id VARCHAR(36) NOT NULL, "
-+                   "type VARCHAR(5) NOT NULL, "
-+                   "delay INTEGER NOT NULL, "
-+                   "timeout INTEGER NOT NULL, "
-+                   "max_retries INTEGER NOT NULL, "
-+                   "http_method VARCHAR(16), "
-+                   "url_path VARCHAR(255), "
-+                   "expected_codes VARCHAR(64), "
-+                   "admin_state_up BOOLEAN NOT NULL, "
-+                   "PRIMARY KEY (id), "
-+                   "CONSTRAINT healthmontiors_type CHECK (type IN ('PING', 'TCP', 'HTTP', 'HTTPS')), "
-+                   "CHECK (admin_state_up IN (0, 1)));")
-+        op.execute("INSERT INTO healthmonitors SELECT "
-+                   "tenant_id,id,type,delay,timeout,max_retries,http_method,url_path,expected_codes,admin_state_up "
-+                   "FROM healthmonitors_backup;")
-+        op.execute("DROP TABLE healthmonitors_backup;");
-+    else:
-+        op.drop_column('healthmonitors', 'status')
-+        op.drop_column('healthmonitors', 'status_description')
- def downgrade(active_plugins=None, options=None):
---- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/50d5ba354c23_ml2_binding_vif_details.py
-+++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/50d5ba354c23_ml2_binding_vif_details.py
-@@ -44,17 +44,58 @@ def upgrade(active_plugins=None, options
-     if not migration.should_run(active_plugins, migration_for_plugins):
-         return
--    op.add_column('ml2_port_bindings',
--                  sa.Column('vif_details', sa.String(length=4095),
--                            nullable=False, server_default=''))
--    migr_context = context.get_context()
--    with context.begin_transaction():
-+    bind = op.get_bind()
-+    engine = bind.engine
-+    if engine.name == 'sqlite':
-+        op.execute("CREATE TEMPORARY TABLE ml2_port_bindings_backup ( "
-+                   "port_id VARCHAR(36) NOT NULL, "
-+                   "host VARCHAR(255) NOT NULL, "
-+                   "vif_type VARCHAR(64) NOT NULL, "
-+                   "cap_port_filter BOOLEAN NOT NULL, "
-+                   "driver VARCHAR(64), "
-+                   "segment VARCHAR(36), "
-+                   "vnic_type VARCHAR(64) DEFAULT 'normal' NOT NULL, "
-+                   "vif_details VARCHAR(4095) DEFAULT '' NOT NULL, "
-+                   "PRIMARY KEY (port_id), "
-+                   "FOREIGN KEY(port_id) REFERENCES ports (id) ON DELETE CASCADE, "
-+                   "FOREIGN KEY(segment) REFERENCES ml2_network_segments (id) ON DELETE SET NULL, "
-+                   "CHECK (cap_port_filter IN (0, 1)));")
-+        op.execute("INSERT INTO ml2_port_bindings_backup "
-+                   "(port_id,host,vif_type,cap_port_filter,driver,segment,vnic_type) "
-+                   "SELECT port_id,host,vif_type,cap_port_filter,driver,segment,vnic_type "
-+                   "FROM ml2_port_bindings;")
-         for value in ('true', 'false'):
--            migr_context.execute(
--                "UPDATE ml2_port_bindings SET"
--                " vif_details = '{\"port_filter\": %(value)s}'"
--                " WHERE cap_port_filter = %(value)s" % {'value': value})
--    op.drop_column('ml2_port_bindings', 'cap_port_filter')
-+            op.execute("UPDATE ml2_port_bindings_backup SET"
-+                       " vif_details = '{\"port_filter\": %(value)s}'"
-+                       " WHERE cap_port_filter = '%(value)s'" % {'value': value})
-+        op.execute("DROP TABLE ml2_port_bindings")
-+        op.execute("CREATE TABLE ml2_port_bindings ( "
-+                   "port_id VARCHAR(36) NOT NULL, "
-+                   "host VARCHAR(255) NOT NULL, "
-+                   "vif_type VARCHAR(64) NOT NULL, "
-+                   "driver VARCHAR(64), "
-+                   "segment VARCHAR(36), "
-+                   "vnic_type VARCHAR(64) DEFAULT 'normal' NOT NULL, "
-+                   "vif_details VARCHAR(4095) DEFAULT '' NOT NULL, "
-+                   "PRIMARY KEY (port_id), "
-+                   "FOREIGN KEY(port_id) REFERENCES ports (id) ON DELETE CASCADE, "
-+                   "FOREIGN KEY(segment) REFERENCES ml2_network_segments (id) ON DELETE SET NULL);")
-+        op.execute("INSERT INTO ml2_port_bindings "
-+                   "SELECT port_id,host,vif_type,driver,segment,vnic_type,vif_details "
-+                   "FROM ml2_port_bindings_backup;")
-+        op.execute("DROP TABLE ml2_port_bindings_backup")
-+    else:
-+        op.add_column('ml2_port_bindings',
-+                      sa.Column('vif_details', sa.String(length=4095),
-+                                nullable=False, server_default=''))
-+        migr_context = context.get_context()
-+        with context.begin_transaction():
-+            for value in ('true', 'false'):
-+                migr_context.execute(
-+                    "UPDATE ml2_port_bindings SET"
-+                    " vif_details = '{\"port_filter\": %(value)s}'"
-+                    " WHERE cap_port_filter = %(value)s" % {'value': value})
-+        op.drop_column('ml2_port_bindings', 'cap_port_filter')
- def downgrade(active_plugins=None, options=None):
---- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py
-+++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py
-@@ -43,9 +43,15 @@ def upgrade(active_plugins=None, options
-     if not migration.should_run(active_plugins, migration_for_plugins):
-         return
--    op.add_column('poolmonitorassociations', sa.Column('status',
--                                                       sa.String(16),
--                                                       nullable=False))
-+    bind = op.get_bind()
-+    engine = bind.engine
-+    if engine.name == 'sqlite':
-+        op.add_column('poolmonitorassociations', sa.Column('status',
-+                                                           sa.String(16)))
-+    else:
-+        op.add_column('poolmonitorassociations', sa.Column('status',
-+                                                           sa.String(16),
-+                                                           nullable=False))
-     op.add_column('poolmonitorassociations', sa.Column('status_description',
-                                                        sa.String(255)))
---- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py
-+++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/e197124d4b9_add_unique_constrain.py
-@@ -47,11 +47,17 @@ def upgrade(active_plugins=None, options
-     if not migration.should_run(active_plugins, migration_for_plugins):
-         return
--    op.create_unique_constraint(
--        name=CONSTRAINT_NAME,
--        source=TABLE_NAME,
--        local_cols=['pool_id', 'address', 'protocol_port']
--    )
-+    bind = op.get_bind()
-+    engine = bind.engine
-+    if engine.name == 'sqlite':
-+        op.execute("CREATE UNIQUE INDEX uniq_member0pool_id0address0port "
-+                   "on members (pool_id,address,protocol_port);")
-+    else:
-+        op.create_unique_constraint(
-+            name=CONSTRAINT_NAME,
-+            source=TABLE_NAME,
-+            local_cols=['pool_id', 'address', 'protocol_port']
-+        )
- def downgrade(active_plugins=None, options=None):
---- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/abc88c33f74f_lb_stats_needs_bigint.py
-+++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/abc88c33f74f_lb_stats_needs_bigint.py
-@@ -43,14 +43,19 @@ def upgrade(active_plugins=None, options
-     if not migration.should_run(active_plugins, migration_for_plugins):
-         return
--    op.alter_column('poolstatisticss', 'bytes_in',
--                    type_=sa.BigInteger(), existing_type=sa.Integer())
--    op.alter_column('poolstatisticss', 'bytes_out',
--                    type_=sa.BigInteger(), existing_type=sa.Integer())
--    op.alter_column('poolstatisticss', 'active_connections',
--                    type_=sa.BigInteger(), existing_type=sa.Integer())
--    op.alter_column('poolstatisticss', 'total_connections',
--                    type_=sa.BigInteger(), existing_type=sa.Integer())
-+    bind = op.get_bind()
-+    engine = bind.engine
-+    # There's no such thing as "BIGINT" in SQLite, just INTEGER,
-+    # so we have nothing to do for SQLite.
-+    if engine.name != 'sqlite':
-+        op.alter_column('poolstatisticss', 'bytes_in',
-+                        type_=sa.BigInteger(), existing_type=sa.Integer())
-+        op.alter_column('poolstatisticss', 'bytes_out',
-+                        type_=sa.BigInteger(), existing_type=sa.Integer())
-+        op.alter_column('poolstatisticss', 'active_connections',
-+                        type_=sa.BigInteger(), existing_type=sa.Integer())
-+        op.alter_column('poolstatisticss', 'total_connections',
-+                        type_=sa.BigInteger(), existing_type=sa.Integer())
- def downgrade(active_plugins=None, options=None):
---- neutron-2014.1~rc1.orig/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py
-+++ neutron-2014.1~rc1/neutron/db/migration/alembic_migrations/versions/1fcfc149aca4_agents_unique_by_type_and_host.py
-@@ -55,11 +55,17 @@ def upgrade(active_plugins=None, options
-     if not migration.should_run(active_plugins, migration_for_plugins):
-         return
--    op.create_unique_constraint(
--        name=UC_NAME,
--        source=TABLE_NAME,
--        local_cols=['agent_type', 'host']
--    )
-+    bind = op.get_bind()
-+    engine = bind.engine
-+    if engine.name == 'sqlite':
-+        op.execute("CREATE UNIQUE INDEX uniq_agents0agent_type0host "
-+                   "on agents (agent_type,host);")
-+    else:
-+        op.create_unique_constraint(
-+            name=UC_NAME,
-+            source=TABLE_NAME,
-+            local_cols=['agent_type', 'host']
-+        )
- def downgrade(active_plugins=None, options=None):
index 54984b066a52dfcb3aa4ddad3e91c082c5af7e7c..25b97dfe6b92bb75be0fba09dee0df6356263425 100644 (file)
@@ -1,3 +1,2 @@
 fix-alembic-migration-with-sqlite3.patch
 better-config-default.patch
-fixes-more-migration-issues-with-sqlite.patch