Merge "db: add missing primary key in firewall_group_associations_v2"
This commit is contained in:
commit
99208b9f67
neutron_fwaas/db/migration/alembic_migrations/versions
releasenotes/notes
53
neutron_fwaas/db/migration/alembic_migrations/versions/2025.1/expand/2a0d33e9ef63_add_pk_firewall_group_associations_v2.py
Normal file
53
neutron_fwaas/db/migration/alembic_migrations/versions/2025.1/expand/2a0d33e9ef63_add_pk_firewall_group_associations_v2.py
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright 2019 Canonical Ltd.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
"""add pk firewall_group_associations_v2
|
||||
|
||||
Revision ID: 2a0d33e9ef63
|
||||
Revises: 6941ce70131e
|
||||
Create Date: 2025-01-20 18:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy.engine import reflection
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2a0d33e9ef63'
|
||||
down_revision = '6941ce70131e'
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def upgrade():
|
||||
bind = op.get_bind()
|
||||
insp = reflection.Inspector.from_engine(bind.engine)
|
||||
if 'firewall_group_port_associations_v2' not in insp.get_table_names():
|
||||
return
|
||||
pk = insp.get_pk_constraint('firewall_group_port_associations_v2')
|
||||
if not pk['constrained_columns']:
|
||||
op.create_primary_key(
|
||||
'pk_firewall_group_port_associations_v2',
|
||||
'firewall_group_port_associations_v2',
|
||||
['firewall_group_id', 'port_id'])
|
||||
else:
|
||||
# Revision '6941ce70131e' has been updated to create the
|
||||
# missing PK. Depending whether the env is already deployed or
|
||||
# not we may or not have to add the primary key.
|
||||
LOG.info("The primary key in firewall_group_port_associations_v2 "
|
||||
"already exists, continuing.")
|
@ -1 +1 @@
|
||||
6941ce70131e
|
||||
2a0d33e9ef63
|
||||
|
@ -103,6 +103,10 @@ def upgrade():
|
||||
sa.ForeignKey('ports.id', ondelete='CASCADE'),
|
||||
nullable=False)
|
||||
)
|
||||
op.create_primary_key(
|
||||
'pk_firewall_group_port_associations_v2',
|
||||
'firewall_group_port_associations_v2',
|
||||
['firewall_group_id', 'port_id'])
|
||||
|
||||
op.create_table(
|
||||
'firewall_policy_rule_associations_v2',
|
||||
|
7
releasenotes/notes/add-missing-pk-firewall_group_associations_v2-3fddb21b3a19b598.yaml
Normal file
7
releasenotes/notes/add-missing-pk-firewall_group_associations_v2-3fddb21b3a19b598.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
A change has been made in the database structures to add missing
|
||||
primary key for the table 'firewall_group_associations_v2'. This
|
||||
would have the benefit effect to fix an issue with Percona when
|
||||
running in ENFORCING mode.
|
Loading…
x
Reference in New Issue
Block a user