| """empty message |
| |
| Revision ID: 49e85e3d5025 |
| Revises: |
| Create Date: 2019-09-30 07:54:31.997740 |
| |
| """ |
| from alembic import op |
| import sqlalchemy as sa |
| |
| |
| # revision identifiers, used by Alembic. |
| revision = '49e85e3d5025' |
| down_revision = None |
| branch_labels = None |
| depends_on = None |
| |
| |
| def upgrade(): |
| # ### commands auto generated by Alembic - please adjust! ### |
| op.create_table('booking_status', |
| sa.Column('id', sa.Integer(), nullable=False), |
| sa.Column('status_text', sa.String(length=64), nullable=True), |
| sa.Column('status_description', sa.String(length=128), nullable=True), |
| sa.PrimaryKeyConstraint('id') |
| ) |
| op.create_table('stack', |
| sa.Column('id', sa.Integer(), nullable=False), |
| sa.Column('stack_name', sa.String(length=64), nullable=True), |
| sa.Column('stack_description', sa.String(length=128), nullable=True), |
| sa.Column('is_sandbox_enabled', sa.Boolean(create_constraint=8), nullable=True), |
| sa.PrimaryKeyConstraint('id'), |
| sa.UniqueConstraint('stack_description') |
| ) |
| op.create_index(op.f('ix_stack_stack_name'), 'stack', ['stack_name'], unique=True) |
| op.create_table('user_organization', |
| sa.Column('id', sa.Integer(), nullable=False), |
| sa.Column('org_name', sa.String(length=32), nullable=True), |
| sa.Column('org_description', sa.String(length=128), nullable=True), |
| sa.PrimaryKeyConstraint('id') |
| ) |
| op.create_index(op.f('ix_user_organization_org_name'), 'user_organization', ['org_name'], unique=True) |
| op.create_table('user_role', |
| sa.Column('id', sa.Integer(), nullable=False), |
| sa.Column('role_name', sa.String(length=32), nullable=True), |
| sa.Column('role_description', sa.String(length=128), nullable=True), |
| sa.PrimaryKeyConstraint('id') |
| ) |
| op.create_index(op.f('ix_user_role_role_name'), 'user_role', ['role_name'], unique=True) |
| op.create_table('scenario', |
| sa.Column('id', sa.Integer(), nullable=False), |
| sa.Column('stack_id', sa.Integer(), nullable=True), |
| sa.Column('scenario_name', sa.String(length=64), nullable=True), |
| sa.Column('scenario_description', sa.String(length=128), nullable=True), |
| sa.Column('is_sandbox_enabled', sa.Boolean(create_constraint=8), nullable=True), |
| sa.ForeignKeyConstraint(['stack_id'], ['stack.id'], ), |
| sa.PrimaryKeyConstraint('id'), |
| sa.UniqueConstraint('scenario_description') |
| ) |
| op.create_index(op.f('ix_scenario_scenario_name'), 'scenario', ['scenario_name'], unique=True) |
| op.create_table('user', |
| sa.Column('id', sa.Integer(), nullable=False), |
| sa.Column('role_id', sa.Integer(), nullable=True), |
| sa.Column('org_id', sa.Integer(), nullable=True), |
| sa.Column('username', sa.String(length=64), nullable=True), |
| sa.Column('email', sa.String(length=128), nullable=True), |
| sa.Column('fullname', sa.String(length=128), nullable=True), |
| sa.Column('password_hash', sa.String(length=128), nullable=True), |
| sa.Column('ssh_public_key', sa.String(length=1024), nullable=True), |
| sa.Column('registered_on', sa.DateTime(), nullable=True), |
| sa.Column('confirmed', sa.Integer(), nullable=True), |
| sa.Column('last_logged_in', sa.DateTime(), nullable=True), |
| sa.Column('confirmed_on', sa.DateTime(), nullable=True), |
| sa.Column('updated_on', sa.DateTime(), nullable=True), |
| sa.Column('token', sa.String(length=32), nullable=True), |
| sa.Column('token_expiration', sa.DateTime(), nullable=True), |
| sa.ForeignKeyConstraint(['org_id'], ['user_organization.id'], ), |
| sa.ForeignKeyConstraint(['role_id'], ['user_role.id'], ), |
| sa.PrimaryKeyConstraint('id') |
| ) |
| op.create_index(op.f('ix_user_confirmed_on'), 'user', ['confirmed_on'], unique=False) |
| op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True) |
| op.create_index(op.f('ix_user_fullname'), 'user', ['fullname'], unique=True) |
| op.create_index(op.f('ix_user_last_logged_in'), 'user', ['last_logged_in'], unique=False) |
| op.create_index(op.f('ix_user_registered_on'), 'user', ['registered_on'], unique=False) |
| op.create_index(op.f('ix_user_token'), 'user', ['token'], unique=True) |
| op.create_index(op.f('ix_user_updated_on'), 'user', ['updated_on'], unique=False) |
| op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True) |
| op.create_table('booking', |
| sa.Column('id', sa.Integer(), nullable=False), |
| sa.Column('user_id', sa.Integer(), nullable=True), |
| sa.Column('status_id', sa.Integer(), nullable=True), |
| sa.Column('booking_length', sa.Integer(), nullable=True), |
| sa.Column('created_on', sa.DateTime(), nullable=True), |
| sa.Column('updated_on', sa.DateTime(), nullable=True), |
| sa.Column('expires_on', sa.DateTime(), nullable=True), |
| sa.Column('heat_stack_name', sa.String(length=64), nullable=True), |
| sa.Column('floating_ip', sa.String(length=64), nullable=True), |
| sa.Column('engine_version', sa.String(length=64), nullable=True), |
| sa.Column('stack', sa.String(length=64), nullable=True), |
| sa.Column('stack_version', sa.String(length=64), nullable=True), |
| sa.Column('scenario', sa.String(length=64), nullable=True), |
| sa.Column('scenario_version', sa.String(length=64), nullable=True), |
| sa.Column('scenario_deploy_log_url', sa.String(length=256), nullable=True), |
| sa.ForeignKeyConstraint(['status_id'], ['booking_status.id'], ), |
| sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), |
| sa.PrimaryKeyConstraint('id') |
| ) |
| op.create_index(op.f('ix_booking_created_on'), 'booking', ['created_on'], unique=False) |
| op.create_index(op.f('ix_booking_expires_on'), 'booking', ['expires_on'], unique=False) |
| op.create_index(op.f('ix_booking_updated_on'), 'booking', ['updated_on'], unique=False) |
| # ### end Alembic commands ### |
| |
| |
| def downgrade(): |
| # ### commands auto generated by Alembic - please adjust! ### |
| op.drop_index(op.f('ix_booking_updated_on'), table_name='booking') |
| op.drop_index(op.f('ix_booking_expires_on'), table_name='booking') |
| op.drop_index(op.f('ix_booking_created_on'), table_name='booking') |
| op.drop_table('booking') |
| op.drop_index(op.f('ix_user_username'), table_name='user') |
| op.drop_index(op.f('ix_user_updated_on'), table_name='user') |
| op.drop_index(op.f('ix_user_token'), table_name='user') |
| op.drop_index(op.f('ix_user_registered_on'), table_name='user') |
| op.drop_index(op.f('ix_user_last_logged_in'), table_name='user') |
| op.drop_index(op.f('ix_user_fullname'), table_name='user') |
| op.drop_index(op.f('ix_user_email'), table_name='user') |
| op.drop_index(op.f('ix_user_confirmed_on'), table_name='user') |
| op.drop_table('user') |
| op.drop_index(op.f('ix_scenario_scenario_name'), table_name='scenario') |
| op.drop_table('scenario') |
| op.drop_index(op.f('ix_user_role_role_name'), table_name='user_role') |
| op.drop_table('user_role') |
| op.drop_index(op.f('ix_user_organization_org_name'), table_name='user_organization') |
| op.drop_table('user_organization') |
| op.drop_index(op.f('ix_stack_stack_name'), table_name='stack') |
| op.drop_table('stack') |
| op.drop_table('booking_status') |
| # ### end Alembic commands ### |