"Fossies" - the Fresh Open Source Software Archive

Member "octavia-3.0.2/octavia/db/migration/alembic_migrations/versions/52377704420e_add_timestamps_to_healthmonitor.py" (19 Dec 2018, 1737 Bytes) of package /linux/misc/openstack/octavia-3.0.2.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 "52377704420e_add_timestamps_to_healthmonitor.py" see the Fossies "Dox" file reference documentation.

    1 #    Copyright 2017 GoDaddy
    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 """add timestamps and operating_status to healthmonitor
   16 
   17 Revision ID: 52377704420e
   18 Revises: d85ca7258d21
   19 Create Date: 2017-04-13 08:58:18.078170
   20 
   21 """
   22 
   23 from alembic import op
   24 import sqlalchemy as sa
   25 
   26 from octavia.common import constants
   27 
   28 # revision identifiers, used by Alembic.
   29 revision = '52377704420e'
   30 down_revision = 'd85ca7258d21'
   31 
   32 
   33 def upgrade():
   34     op.add_column(
   35         u'health_monitor',
   36         sa.Column(u'created_at', sa.DateTime(), nullable=True)
   37     )
   38     op.add_column(
   39         u'health_monitor',
   40         sa.Column(u'updated_at', sa.DateTime(), nullable=True)
   41     )
   42 
   43     op.add_column(u'health_monitor',
   44                   sa.Column(u'operating_status',
   45                             sa.String(16),
   46                             nullable=False,
   47                             server_default=constants.ONLINE)
   48                   )
   49     op.alter_column(u'health_monitor', u'operating_status',
   50                     existing_type=sa.String(16), server_default=None)
   51 
   52     op.create_foreign_key(
   53         u'fk_health_monitor_operating_status_name', u'health_monitor',
   54         u'operating_status', [u'operating_status'], [u'name']
   55     )