cue/cue/db/sqlalchemy/alembic/versions/3917e931a55a_create_broker.py

67 lines
2.3 KiB
Python

# -*- encoding: utf-8 -*-
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# 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 broker and brokerMetadata
Revision ID: 3917e931a55a
Revises: 236f63c96b6a
Create Date: 2015-03-30 16:31:57.360063
"""
# revision identifiers, used by Alembic.
revision = '3917e931a55a'
down_revision = '236f63c96b6a'
from alembic import op
import sqlalchemy as sa
from cue.db.sqlalchemy import types
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('broker',
sa.Column('id', types.UUID(), nullable=False),
sa.Column('name', sa.String(length=255), nullable=False),
sa.Column('active', sa.Boolean(), nullable=False),
sa.Column('deleted', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('deleted_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('broker_metadata',
sa.Column('id', types.UUID(), nullable=False),
sa.Column('broker_id', types.UUID(), nullable=False),
sa.Column('key', sa.String(length=255), nullable=False),
sa.Column('value', sa.String(length=255), nullable=False),
sa.Column('deleted', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=False),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('deleted_at', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['broker_id'], ['broker.id'], ),
sa.PrimaryKeyConstraint('id')
)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_table('broker_metadata')
op.drop_table('broker')
### end Alembic commands ###