"Fossies" - the Fresh Open Source Software Archive

Member "octavia-3.1.1/octavia/db/migration/alembic_migrations/versions/357d17a6d5ac_update_lb_and_amphora_data_model_for_.py" (6 Jun 2019, 2391 Bytes) of package /linux/misc/openstack/octavia-3.1.1.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 "357d17a6d5ac_update_lb_and_amphora_data_model_for_.py" see the Fossies "Dox" file reference documentation.

    1 # Copyright 2015 Hewlett-Packard Development Company, L.P.
    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 """update lb and amphora data model for active passive
   17 
   18 Revision ID: 357d17a6d5ac
   19 Revises: 298eac0640a7
   20 Create Date: 2015-07-16 17:41:49.029145
   21 
   22 """
   23 
   24 from alembic import op
   25 import sqlalchemy as sa
   26 from sqlalchemy import sql
   27 
   28 # revision identifiers, used by Alembic.
   29 revision = '357d17a6d5ac'
   30 down_revision = '298eac0640a7'
   31 
   32 
   33 def upgrade():
   34     op.create_table(
   35         u'lb_topology',
   36         sa.Column(u'name', sa.String(36), primary_key=True),
   37         sa.Column(u'description', sa.String(255), nullable=True)
   38     )
   39 
   40     insert_table = sql.table(
   41         u'lb_topology',
   42         sql.column(u'name', sa.String),
   43         sql.column(u'description', sa.String)
   44     )
   45 
   46     op.bulk_insert(
   47         insert_table,
   48         [
   49             {'name': 'SINGLE'},
   50             {'name': 'ACTIVE_STANDBY'}
   51         ]
   52     )
   53 
   54     op.create_table(
   55         u'amphora_roles',
   56         sa.Column(u'name', sa.String(36), primary_key=True),
   57         sa.Column(u'description', sa.String(255), nullable=True)
   58     )
   59 
   60     insert_table = sql.table(
   61         u'amphora_roles',
   62         sql.column(u'name', sa.String),
   63         sql.column(u'description', sa.String)
   64     )
   65 
   66     op.bulk_insert(
   67         insert_table,
   68         [
   69             {'name': 'MASTER'},
   70             {'name': 'BACKUP'},
   71             {'name': 'STANDALONE'}
   72         ]
   73     )
   74 
   75     op.add_column(
   76         u'load_balancer',
   77         sa.Column(u'topology', sa.String(36),
   78                   sa.ForeignKey(u'lb_topology.name',
   79                                 name=u'fk_lb_topology_name'),
   80                   nullable=True)
   81     )
   82 
   83     op.add_column(
   84         u'amphora',
   85         sa.Column(u'role', sa.String(36),
   86                   sa.ForeignKey(u'amphora_roles.name',
   87                                 name=u'fk_amphora_roles_name'),
   88                   nullable=True)
   89     )