config/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/migrate_repo/versions/055_partition_device_node.py

35 lines
947 B
Python

# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2017 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from sqlalchemy import String
from sqlalchemy import Column, MetaData, Table
from migrate.changeset import UniqueConstraint
ENGINE = 'InnoDB'
CHARSET = 'utf8'
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
partition = Table('partition', meta, autoload=True)
# Add the 'device_node' column to the partition table.
partition.create_column(Column('device_node', String(64)))
# Add unique constraint for a partition's device path.
UniqueConstraint('device_path', 'forihostid', table=partition,
name='u_partition_path_host_id').create()
def downgrade(migrate_engine):
# As per other openstack components, downgrade is
# unsupported in this release.
raise NotImplementedError('SysInv database downgrade is unsupported.')