"""init tables

Revision ID: a8275911e40a
Revises: 
Create Date: 2021-09-26 13:37:10.117554

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('harbor',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('harbor_code', sa.String(), nullable=False),
    sa.Column('created', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('harbor_code'),
    sa.UniqueConstraint('id')
    )
    op.create_table('ship',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('created', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_table('shipment',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('from_harbor', sa.Integer(), nullable=False),
    sa.Column('to_harbor', sa.Integer(), nullable=False),
    sa.Column('leave_date', sa.Date(), nullable=False),
    sa.Column('arrival_date', sa.Date(), nullable=True),
    sa.Column('created', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.ForeignKeyConstraint(['from_harbor'], ['harbor.id'], ),
    sa.ForeignKeyConstraint(['to_harbor'], ['harbor.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    # ### end Alembic commands ###


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