"""empty message

Revision ID: b846613b404e
Revises: fc25bf71d841
Create Date: 2020-01-06 21:43:28.958558

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('loan',
    sa.Column('uuid', postgresql.UUID(as_uuid=True), nullable=False),
    sa.Column('code', sa.String(length=20), nullable=True),
    sa.Column('borrower_code', sa.String(length=20), nullable=True),
    sa.Column('type_loan', sa.String(length=20), nullable=True),
    sa.Column('date_loan', sa.DateTime(), nullable=True),
    sa.Column('date_start', sa.Date(), nullable=True),
    sa.Column('date_end', sa.Date(), nullable=True),
    sa.Column('term', sa.Integer(), nullable=True),
    sa.Column('type_schedule', sa.String(length=20), nullable=True),
    sa.Column('is_settled', sa.Boolean(), nullable=True),
    sa.Column('amount', sa.Float(), nullable=True),
    sa.Column('interest_rate', sa.Float(), nullable=True),
    sa.Column('interest_amount', sa.Float(), nullable=True),
    sa.Column('remarks', sa.String(length=50), nullable=True),
    sa.PrimaryKeyConstraint('uuid'),
    sa.UniqueConstraint('code')
    )
    op.create_table('loan_detail',
    sa.Column('uuid', postgresql.UUID(as_uuid=True), nullable=False),
    sa.Column('loan_code', sa.String(length=20), nullable=True),
    sa.Column('type_line', sa.String(length=20), nullable=True),
    sa.Column('amount_to_pay', sa.Float(), nullable=True),
    sa.Column('amount_payed', sa.Float(), nullable=True),
    sa.Column('date_to_pay', sa.Date(), nullable=True),
    sa.Column('date_payed', sa.Date(), nullable=True),
    sa.PrimaryKeyConstraint('uuid')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('loan_detail')
    op.drop_table('loan')
    # ### end Alembic commands ###
