<reponame>cameron-freshworks/ppr<filename>ppr-api/migrations/versions/fc0ad427d293_add_gc_legacy_table.py<gh_stars>1-10
"""add gc legacy table

Revision ID: fc0ad427d293
Revises: <PASSWORD>
Create Date: 2021-09-14 16:06:44.905160

"""
from alembic import op
import sqlalchemy as sa
from alembic_utils.pg_function import PGFunction
from sqlalchemy import text as sql_text

# revision identifiers, used by Alembic.
revision = 'fc0ad427d293'
down_revision = '5<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('general_collateral_legacy',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('description', sa.Text(), nullable=False),
    sa.Column('status', sa.String(length=1), nullable=True),
    sa.Column('registration_id', sa.Integer(), nullable=False),
    sa.Column('financing_id', sa.Integer(), nullable=False),
    sa.Column('registration_id_end', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['financing_id'], ['financing_statements.id'], ),
    sa.ForeignKeyConstraint(['registration_id'], ['registrations.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_general_collateral_legacy_financing_id'), 'general_collateral_legacy', ['financing_id'], unique=False)
    op.create_index(op.f('ix_general_collateral_legacy_registration_id'), 'general_collateral_legacy', ['registration_id'], unique=False)
    op.create_index(op.f('ix_general_collateral_legacy_registration_id_end'), 'general_collateral_legacy', ['registration_id_end'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_general_collateral_legacy_registration_id_end'), table_name='general_collateral_legacy')
    op.drop_index(op.f('ix_general_collateral_legacy_registration_id'), table_name='general_collateral_legacy')
    op.drop_index(op.f('ix_general_collateral_legacy_financing_id'), table_name='general_collateral_legacy')
    op.drop_table('general_collateral_legacy')
    # ### end Alembic commands ###

"""add gc legacy table

Revision ID: fc0ad427d293
Revises: <PASSWORD>
Create Date: 2021-09-14 16:06:44.905160

"""
from alembic import op
import sqlalchemy as sa
from alembic_utils.pg_function import PGFunction
from sqlalchemy import text as sql_text

# revision identifiers, used by Alembic.
revision = 'fc0ad427d293'
down_revision = '5<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('general_collateral_legacy',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('description', sa.Text(), nullable=False),
    sa.Column('status', sa.String(length=1), nullable=True),
    sa.Column('registration_id', sa.Integer(), nullable=False),
    sa.Column('financing_id', sa.Integer(), nullable=False),
    sa.Column('registration_id_end', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['financing_id'], ['financing_statements.id'], ),
    sa.ForeignKeyConstraint(['registration_id'], ['registrations.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_general_collateral_legacy_financing_id'), 'general_collateral_legacy', ['financing_id'], unique=False)
    op.create_index(op.f('ix_general_collateral_legacy_registration_id'), 'general_collateral_legacy', ['registration_id'], unique=False)
    op.create_index(op.f('ix_general_collateral_legacy_registration_id_end'), 'general_collateral_legacy', ['registration_id_end'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_general_collateral_legacy_registration_id_end'), table_name='general_collateral_legacy')
    op.drop_index(op.f('ix_general_collateral_legacy_registration_id'), table_name='general_collateral_legacy')
    op.drop_index(op.f('ix_general_collateral_legacy_financing_id'), table_name='general_collateral_legacy')
    op.drop_table('general_collateral_legacy')
    # ### end Alembic commands ###
add gc legacy table  Revision ID: fc0ad427d293 Revises: <PASSWORD> Create Date: 2021-09-14 16:06:44.905160 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###