"""user table

Revision ID: fd342a5c2a0a
Revises: 
Create Date: 2020-06-21 09:46:39.986111

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('listing',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('db_title', sa.String(length=64), nullable=True),
    sa.Column('db_state', sa.String(length=2), nullable=True),
    sa.Column('db_county', sa.String(length=64), nullable=True),
    sa.Column('db_price', sa.Integer(), nullable=True),
    sa.Column('db_acres', sa.Float(), nullable=True),
    sa.Column('db_images', sa.String(length=20), nullable=True),
    sa.Column('db_short', sa.String(length=64), nullable=True),
    sa.Column('db_long', sa.String(length=500), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_listing_db_acres'), 'listing', ['db_acres'], unique=False)
    op.create_index(op.f('ix_listing_db_images'), 'listing', ['db_images'], unique=False)
    op.create_index(op.f('ix_listing_db_long'), 'listing', ['db_long'], unique=False)
    op.create_index(op.f('ix_listing_db_price'), 'listing', ['db_price'], unique=False)
    op.create_index(op.f('ix_listing_db_title'), 'listing', ['db_title'], unique=False)
    op.create_index(op.f('ix_listing_timestamp'), 'listing', ['timestamp'], unique=False)
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('password_hash', sa.String(length=120), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_password_hash'), 'user', ['password_hash'], unique=False)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_password_hash'), table_name='user')
    op.drop_table('user')
    op.drop_index(op.f('ix_listing_timestamp'), table_name='listing')
    op.drop_index(op.f('ix_listing_db_title'), table_name='listing')
    op.drop_index(op.f('ix_listing_db_price'), table_name='listing')
    op.drop_index(op.f('ix_listing_db_long'), table_name='listing')
    op.drop_index(op.f('ix_listing_db_images'), table_name='listing')
    op.drop_index(op.f('ix_listing_db_acres'), table_name='listing')
    op.drop_table('listing')
    # ### end Alembic commands ###
