"""Create zips table

Revision ID: 805a96ddd8c2
Revises: f57696aefcc1
Create Date: 2017-04-24 14:19:00.446410

"""

# revision identifiers, used by Alembic.
revision = '805a96ddd8c2'
down_revision = 'f57696aefcc1'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_data_broker():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('zips',
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('zips_id', sa.Integer(), nullable=False),
    sa.Column('zip5', sa.Text(), nullable=True),
    sa.Column('zip_last4', sa.Text(), nullable=True),
    sa.Column('state_abbreviation', sa.Text(), nullable=True),
    sa.Column('county_number', sa.Text(), nullable=True),
    sa.Column('congressional_district_no', sa.Text(), nullable=True),
    sa.PrimaryKeyConstraint('zips_id'),
    sa.UniqueConstraint('zip5', 'zip_last4', name='uniq_zip5_zip_last4')
    )
    op.create_index(op.f('ix_zips_zip5'), 'zips', ['zip5'], unique=False)
    op.create_index(op.f('ix_zips_zip_last4'), 'zips', ['zip_last4'], unique=False)
    ### end Alembic commands ###


def downgrade_data_broker():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_zips_zip_last4'), table_name='zips')
    op.drop_index(op.f('ix_zips_zip5'), table_name='zips')
    op.drop_table('zips')
    ### end Alembic commands ###

