"""Add formation

Revision ID: 3bc5fc4758
Revises: 17034142d9b
Create Date: 2015-07-20 22:57:54.221307

"""

# revision identifiers, used by Alembic.
revision = '3bc5fc4758'
down_revision = '17034142d9b'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('formation',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('office_code', sa.String(), nullable=False),
    sa.Column('uic', sa.String(), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('soldier_formation',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('formation_id', sa.Integer(), nullable=False),
    sa.Column('soldier_id', sa.Integer(), nullable=False),
    sa.Column('start_date', sa.Date(), nullable=True),
    sa.Column('end_date', sa.Date(), nullable=True),
    sa.ForeignKeyConstraint(['formation_id'], ['formation.id'], ),
    sa.ForeignKeyConstraint(['soldier_id'], ['soldier.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ###


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