"""ok

Revision ID: a048e0dd6024
Revises: 
Create Date: 2019-12-04 05:22:41.034147

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a048e0dd6024'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('holders_right',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('names', sa.String(length=150), nullable=True),
    sa.Column('acno', sa.Integer(), nullable=True),
    sa.Column('fname', sa.String(length=150), nullable=True),
    sa.Column('oname', sa.String(length=150), nullable=True),
    sa.Column('lname', sa.String(length=150), nullable=True),
    sa.Column('address', sa.String(length=500), nullable=True),
    sa.Column('holdings', sa.Integer(), nullable=True),
    sa.Column('right_due', sa.Integer(), nullable=True),
    sa.Column('unit_price', sa.Float(), nullable=True),
    sa.Column('company', sa.String(length=140), nullable=True),
    sa.Column('bvn', sa.Integer(), nullable=True),
    sa.Column('chn', sa.Integer(), nullable=True),
    sa.Column('phone', sa.Integer(), nullable=True),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.Column('cscs_account_no', sa.Integer(), nullable=True),
    sa.Column('amount', sa.Float(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_holders_right_acno'), 'holders_right', ['acno'], unique=False)
    op.create_index(op.f('ix_holders_right_bvn'), 'holders_right', ['bvn'], unique=False)
    op.create_index(op.f('ix_holders_right_chn'), 'holders_right', ['chn'], unique=False)
    op.create_index(op.f('ix_holders_right_cscs_account_no'), 'holders_right', ['cscs_account_no'], unique=False)
    op.create_index(op.f('ix_holders_right_fname'), 'holders_right', ['fname'], unique=False)
    op.create_index(op.f('ix_holders_right_id'), 'holders_right', ['id'], unique=True)
    op.create_index(op.f('ix_holders_right_lname'), 'holders_right', ['lname'], unique=False)
    op.create_index(op.f('ix_holders_right_oname'), 'holders_right', ['oname'], unique=False)
    op.create_table('search_option',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('code', sa.String(length=7), nullable=True),
    sa.Column('display_name', sa.String(length=15), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_search_option_code'), 'search_option', ['code'], unique=False)
    op.create_index(op.f('ix_search_option_display_name'), 'search_option', ['display_name'], unique=False)
    op.create_index(op.f('ix_search_option_id'), 'search_option', ['id'], unique=True)
    op.create_table('share_holder',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('sn', sa.Integer(), nullable=True),
    sa.Column('acno', sa.Integer(), nullable=True),
    sa.Column('name', sa.String(length=300), nullable=False),
    sa.Column('bvn', sa.Integer(), nullable=True),
    sa.Column('chn', sa.Integer(), nullable=True),
    sa.Column('phone', sa.Integer(), nullable=True),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.Column('cscs_account_no', sa.Integer(), nullable=True),
    sa.Column('address', sa.String(length=300), nullable=True),
    sa.Column('agent_member_code', sa.String(length=20), nullable=True),
    sa.Column('timestamp', sa.String(length=20), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('sn')
    )
    op.create_index(op.f('ix_share_holder_acno'), 'share_holder', ['acno'], unique=True)
    op.create_index(op.f('ix_share_holder_bvn'), 'share_holder', ['bvn'], unique=False)
    op.create_index(op.f('ix_share_holder_chn'), 'share_holder', ['chn'], unique=False)
    op.create_index(op.f('ix_share_holder_cscs_account_no'), 'share_holder', ['cscs_account_no'], unique=False)
    op.create_index(op.f('ix_share_holder_id'), 'share_holder', ['id'], unique=True)
    op.create_index(op.f('ix_share_holder_timestamp'), 'share_holder', ['timestamp'], unique=False)
    op.create_table('right',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('acno', sa.Integer(), nullable=True),
    sa.Column('unit_held', sa.Integer(), nullable=True),
    sa.Column('right_due', sa.Integer(), nullable=True),
    sa.Column('holder', sa.Integer(), nullable=True),
    sa.Column('amount', sa.Float(), nullable=True),
    sa.Column('company', sa.String(length=140), nullable=True),
    sa.Column('right_date', sa.String(length=14), nullable=True),
    sa.Column('right_applied', sa.Integer(), nullable=True),
    sa.Column('additional_right_applied', sa.Integer(), nullable=True),
    sa.Column('additional_apply', sa.Integer(), nullable=True),
    sa.Column('additional_price', sa.Integer(), nullable=True),
    sa.Column('balance', sa.Integer(), nullable=True),
    sa.Column('timestamp', sa.String(length=20), nullable=True),
    sa.ForeignKeyConstraint(['holder'], ['share_holder.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_right_acno'), 'right', ['acno'], unique=True)
    op.create_index(op.f('ix_right_id'), 'right', ['id'], unique=True)
    op.create_index(op.f('ix_right_timestamp'), 'right', ['timestamp'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_right_timestamp'), table_name='right')
    op.drop_index(op.f('ix_right_id'), table_name='right')
    op.drop_index(op.f('ix_right_acno'), table_name='right')
    op.drop_table('right')
    op.drop_index(op.f('ix_share_holder_timestamp'), table_name='share_holder')
    op.drop_index(op.f('ix_share_holder_id'), table_name='share_holder')
    op.drop_index(op.f('ix_share_holder_cscs_account_no'), table_name='share_holder')
    op.drop_index(op.f('ix_share_holder_chn'), table_name='share_holder')
    op.drop_index(op.f('ix_share_holder_bvn'), table_name='share_holder')
    op.drop_index(op.f('ix_share_holder_acno'), table_name='share_holder')
    op.drop_table('share_holder')
    op.drop_index(op.f('ix_search_option_id'), table_name='search_option')
    op.drop_index(op.f('ix_search_option_display_name'), table_name='search_option')
    op.drop_index(op.f('ix_search_option_code'), table_name='search_option')
    op.drop_table('search_option')
    op.drop_index(op.f('ix_holders_right_oname'), table_name='holders_right')
    op.drop_index(op.f('ix_holders_right_lname'), table_name='holders_right')
    op.drop_index(op.f('ix_holders_right_id'), table_name='holders_right')
    op.drop_index(op.f('ix_holders_right_fname'), table_name='holders_right')
    op.drop_index(op.f('ix_holders_right_cscs_account_no'), table_name='holders_right')
    op.drop_index(op.f('ix_holders_right_chn'), table_name='holders_right')
    op.drop_index(op.f('ix_holders_right_bvn'), table_name='holders_right')
    op.drop_index(op.f('ix_holders_right_acno'), table_name='holders_right')
    op.drop_table('holders_right')
    # ### end Alembic commands ###
