Merge "Add an index on ports.node_id"

This commit is contained in:
Zuul 2025-05-07 18:18:16 +00:00 committed by Gerrit Code Review
commit 782105ebe8
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,27 @@
# 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 index on ports.node_id
Revision ID: 4c8356c965f1
Revises: 1c14278d6e33
Create Date: 2025-04-29 13:26:23.089464
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '4c8356c965f1'
down_revision = '1c14278d6e33'
def upgrade():
op.create_index('ports_node_id_idx', 'ports', ['node_id'])

View File

@ -256,6 +256,7 @@ class Port(Base):
schema.UniqueConstraint('address', name='uniq_ports0address'),
schema.UniqueConstraint('uuid', name='uniq_ports0uuid'),
schema.UniqueConstraint('name', name='uniq_ports0name'),
Index('ports_node_id_idx', 'node_id'),
table_args())
id = Column(Integer, primary_key=True)
uuid = Column(String(36))