]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fixed 11c6e18605c8_pool_monitor_status_.py migration
authorThomas Goirand <thomas@goirand.fr>
Wed, 16 Apr 2014 12:55:52 +0000 (20:55 +0800)
committerThomas Goirand <thomas@goirand.fr>
Wed, 16 Apr 2014 12:55:52 +0000 (20:55 +0800)
Change-Id: Ic6c16c99635505b61b44dc8fce1ccbd10862482a

debian/patches/Properly_apply_column_default_in_migration_pool_monitor_status.patch [new file with mode: 0644]
debian/patches/fix-alembic-migration-with-sqlite3.patch
debian/patches/series

diff --git a/debian/patches/Properly_apply_column_default_in_migration_pool_monitor_status.patch b/debian/patches/Properly_apply_column_default_in_migration_pool_monitor_status.patch
new file mode 100644 (file)
index 0000000..2353aff
--- /dev/null
@@ -0,0 +1,27 @@
+From: Eugene Nikanorov <enikanorov@mirantis.com>
+Date: Thu, 10 Apr 2014 09:36:45 +0000 (+0400)
+Subject: Properly apply column default in migration pool_monitor_status
+X-Git-Url: https://review.openstack.org/gitweb?p=openstack%2Fneutron.git;a=commitdiff_plain;h=c7dceedde516170d1a6ac1257103bdacb3b0cc84
+
+Properly apply column default in migration pool_monitor_status
+
+server_default parameter should be used to apply default value at
+table/column creation time. Otherwise non-nullable column can't
+be created because of existing rows in the tables.
+
+Change-Id: I7136e6a0dfb9dc66ca63ff3c9fcf6de164e27e63
+Closes-Bug: #1305725
+---
+
+diff --git a/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py b/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py
+index a31bf6a..598f2ab 100644
+--- a/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py
++++ b/neutron/db/migration/alembic_migrations/versions/11c6e18605c8_pool_monitor_status_.py
+@@ -45,6 +45,7 @@ def upgrade(active_plugins=None, options=None):
+     op.add_column('poolmonitorassociations', sa.Column('status',
+                                                        sa.String(16),
++                                                       server_default='',
+                                                        nullable=False))
+     op.add_column('poolmonitorassociations', sa.Column('status_description',
+                                                        sa.String(255)))
index 12315a944cecf14c328b328991b5919c157f0858..fcd14cbae26de6cbf2c793a5decbd3b7b89aee16 100644 (file)
@@ -233,27 +233,6 @@ Index: neutron/neutron/db/migration/alembic_migrations/versions/f9263d6df56_remo
  
  
  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
index bc368e184768d72a275aa4a867aeeab028ed0a8d..ee7bdf34658892473df64f9212c02130383ac284 100644 (file)
@@ -3,3 +3,4 @@ better-config-default.patch
 OVS_lib_defer_apply_doesn_t_handle_concurrency.patch
 0001-Add-parameter-and-iptables-rules-to-protect-dnsmasq-.patch
 0004-Fix-Metering-doesn-t-respect-the-l3-agent-binding.patch
+Properly_apply_column_default_in_migration_pool_monitor_status.patch