bc8943c8cc
Closes-Bug: #1563270 Change-Id: I987d846f1a86ecee1fcfb0f99877563a10481478
61 lines
1.8 KiB
Python
61 lines
1.8 KiB
Python
# 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.
|
|
|
|
"""
|
|
Create the environment-template table for the environment
|
|
template functionality.
|
|
|
|
Revision ID: 005
|
|
Revises: table template
|
|
|
|
"""
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '005'
|
|
down_revision = '004'
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
MYSQL_ENGINE = 'InnoDB'
|
|
MYSQL_CHARSET = 'utf8'
|
|
|
|
|
|
def upgrade():
|
|
"""It creates the table environment-template.
|
|
|
|
The name plus the tenant_id should be unique in the table,
|
|
since each tenant cannot duplicate template names.
|
|
"""
|
|
|
|
op.create_table(
|
|
'environment-template',
|
|
sa.Column('created', sa.DateTime(), nullable=False),
|
|
sa.Column('updated', sa.DateTime(), nullable=False),
|
|
sa.Column('id', sa.String(length=255), nullable=False),
|
|
sa.Column('name', sa.String(length=255), nullable=False),
|
|
sa.Column('tenant_id', sa.String(length=36), nullable=False),
|
|
sa.Column('version', sa.BigInteger(), nullable=False),
|
|
sa.Column('description', sa.Text(), nullable=False),
|
|
sa.Column('networking', sa.Text(), nullable=True),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
sa.UniqueConstraint('tenant_id', 'name'),
|
|
mysql_engine=MYSQL_ENGINE,
|
|
mysql_charset=MYSQL_CHARSET
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_table('environment-template')
|