"Fossies" - the Fresh Open Source Software Archive

Member "tacker-4.0.0/tacker/db/migration/alembic_migrations/versions/2c5211036579_add_placement_table.py" (14 Oct 2020, 1834 Bytes) of package /linux/misc/openstack/tacker-4.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "2c5211036579_add_placement_table.py" see the Fossies "Dox" file reference documentation.

    1 # Copyright 2020 OpenStack Foundation
    2 #
    3 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
    4 #    not use this file except in compliance with the License. You may obtain
    5 #    a copy of the License at
    6 #
    7 #         http://www.apache.org/licenses/LICENSE-2.0
    8 #
    9 #    Unless required by applicable law or agreed to in writing, software
   10 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   11 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   12 #    License for the specific language governing permissions and limitations
   13 #    under the License.
   14 #
   15 
   16 """add placement table
   17 
   18 Revision ID: 2c5211036579
   19 Revises: ee98bbc0789d
   20 Create Date: 2020-09-11 20:47:46.345771
   21 
   22 """
   23 # flake8: noqa: E402
   24 
   25 # revision identifiers, used by Alembic.
   26 revision = '2c5211036579'
   27 down_revision = 'ee98bbc0789d'
   28 
   29 from alembic import op
   30 import sqlalchemy as sa
   31 from sqlalchemy import Boolean
   32 
   33 from tacker.db import types
   34 
   35 
   36 def upgrade(active_plugins=None, options=None):
   37     op.create_table(
   38         'placement_constraint',
   39         sa.Column('id', types.Uuid(length=36), nullable=False),
   40         sa.Column('vnf_instance_id', types.Uuid(length=36), nullable=False),
   41         sa.Column('affinity_or_anti_affinity',
   42                   sa.String(length=255), nullable=False),
   43         sa.Column('scope',  sa.String(length=255), nullable=False),
   44         sa.Column('server_group_name',  sa.String(length=255), nullable=False),
   45         sa.Column('resource', sa.JSON(), nullable=False),
   46         sa.Column('created_at', sa.DateTime(), nullable=False),
   47         sa.Column('updated_at', sa.DateTime(), nullable=True),
   48         sa.Column('deleted_at', sa.DateTime(), nullable=True),
   49         sa.Column('deleted', Boolean, default=False),
   50         sa.PrimaryKeyConstraint('id'),
   51         mysql_engine='InnoDB'
   52     )