← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1388230] [NEW] Checks for DB models and migrations sync not working

 

Public bug reported:

I noticed a couple of issues, which might be related.


1. "db-manage revision --autogenerate" on master with no code changes generates:

def upgrade():
    op.drop_index('idx_autoinc_vr_id', table_name='ha_router_vrid_allocations')


2. With the following change to the IPAllocation() model, the revision is not detected. Also, the unit tests for model/migration sync do not give an error.

diff --git a/neutron/db/models_v2.py b/neutron/db/models_v2.py
--- a/neutron/db/models_v2.py
+++ b/neutron/db/models_v2.py
@@ -98,8 +98,8 @@ class IPAllocation(model_base.BASEV2):
 
     port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id',
                                                      ondelete="CASCADE"),
-                        nullable=True)
-    ip_address = sa.Column(sa.String(64), nullable=False, primary_key=True)
+                        nullable=True, primary_key=True)
+    ip_address = sa.Column(sa.String(64), nullable=False)
     subnet_id = sa.Column(sa.String(36), sa.ForeignKey('subnets.id',
                                                        ondelete="CASCADE"),
                           nullable=False, primary_key=True)

** Affects: neutron
     Importance: Undecided
         Status: New


** Tags: db

** Tags added: db

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1388230

Title:
  Checks for DB models and migrations sync not working

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  I noticed a couple of issues, which might be related.

  
  1. "db-manage revision --autogenerate" on master with no code changes generates:

  def upgrade():
      op.drop_index('idx_autoinc_vr_id', table_name='ha_router_vrid_allocations')

  
  2. With the following change to the IPAllocation() model, the revision is not detected. Also, the unit tests for model/migration sync do not give an error.

  diff --git a/neutron/db/models_v2.py b/neutron/db/models_v2.py
  --- a/neutron/db/models_v2.py
  +++ b/neutron/db/models_v2.py
  @@ -98,8 +98,8 @@ class IPAllocation(model_base.BASEV2):
   
       port_id = sa.Column(sa.String(36), sa.ForeignKey('ports.id',
                                                        ondelete="CASCADE"),
  -                        nullable=True)
  -    ip_address = sa.Column(sa.String(64), nullable=False, primary_key=True)
  +                        nullable=True, primary_key=True)
  +    ip_address = sa.Column(sa.String(64), nullable=False)
       subnet_id = sa.Column(sa.String(36), sa.ForeignKey('subnets.id',
                                                          ondelete="CASCADE"),
                             nullable=False, primary_key=True)

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1388230/+subscriptions


Follow ups

References