Merge "Db: Drop redundant indexes for columns already having unique constraint"
This commit is contained in:
commit
d7e9a330f0
@ -0,0 +1,40 @@
|
||||
# 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.
|
||||
|
||||
"""Drop redundant indexes for unique constraints
|
||||
|
||||
Revision ID: a082b8bb98d0
|
||||
Revises: 422ece571366
|
||||
Create Date: 2022-09-09 15:52:21.644040
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a082b8bb98d0'
|
||||
down_revision = '422ece571366'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.drop_index('inventories_resource_provider_id_idx',
|
||||
table_name='inventories')
|
||||
op.drop_index('inventories_resource_provider_resource_class_idx',
|
||||
table_name='inventories')
|
||||
op.drop_index('ix_placement_aggregates_uuid',
|
||||
table_name='placement_aggregates')
|
||||
op.drop_index('resource_providers_name_idx',
|
||||
table_name='resource_providers')
|
||||
op.drop_index('resource_providers_uuid_idx',
|
||||
table_name='resource_providers')
|
@ -50,9 +50,7 @@ class ResourceProvider(BASE):
|
||||
|
||||
__tablename__ = "resource_providers"
|
||||
__table_args__ = (
|
||||
Index('resource_providers_uuid_idx', 'uuid'),
|
||||
schema.UniqueConstraint('uuid', name='uniq_resource_providers0uuid'),
|
||||
Index('resource_providers_name_idx', 'name'),
|
||||
Index('resource_providers_root_provider_id_idx',
|
||||
'root_provider_id'),
|
||||
Index('resource_providers_parent_provider_id_idx',
|
||||
@ -78,12 +76,8 @@ class Inventory(BASE):
|
||||
|
||||
__tablename__ = "inventories"
|
||||
__table_args__ = (
|
||||
Index('inventories_resource_provider_id_idx',
|
||||
'resource_provider_id'),
|
||||
Index('inventories_resource_class_id_idx',
|
||||
'resource_class_id'),
|
||||
Index('inventories_resource_provider_resource_class_idx',
|
||||
'resource_provider_id', 'resource_class_id'),
|
||||
schema.UniqueConstraint(
|
||||
'resource_provider_id', 'resource_class_id',
|
||||
name='uniq_inventories0resource_provider_resource_class')
|
||||
@ -151,7 +145,7 @@ class PlacementAggregate(BASE):
|
||||
)
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
uuid = Column(String(36), index=True)
|
||||
uuid = Column(String(36))
|
||||
|
||||
|
||||
class Trait(BASE):
|
||||
|
Loading…
Reference in New Issue
Block a user