"""Initial Migration

Revision ID: a37f76ceca7a
Revises: 1050f7f8b2b3
Create Date: 2018-10-17 11:54:15.778282

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'a37f76ceca7a'
down_revision = '1050f7f8b2b3'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('comments', sa.Column('name', sa.String(length=255), nullable=True))
    op.drop_constraint('comments_user_id_fkey', 'comments', type_='foreignkey')
    op.drop_column('comments', 'pitch_id')
    op.drop_column('comments', 'user_id')
    op.drop_column('comments', 'comment_content')
    op.add_column('pitches', sa.Column('comments_id', sa.Integer(), nullable=True))
    op.add_column('pitches', sa.Column('description', sa.String(), nullable=True))
    op.add_column('pitches', sa.Column('title', sa.String(length=255), nullable=True))
    op.drop_constraint('pitches_user_id_fkey', 'pitches', type_='foreignkey')
    op.create_foreign_key(None, 'pitches', 'comments', ['comments_id'], ['id'])
    op.drop_column('pitches', 'pitch_content')
    op.drop_column('pitches', 'user_id')
    op.drop_column('pitches', 'pitch_category')
    op.add_column('users', sa.Column('pass_hash', sa.String(length=255), nullable=True))
    op.drop_index('ix_users_username', table_name='users')
    op.drop_column('users', 'profile_pic_path')
    op.drop_column('users', 'pass_secure')
    op.drop_column('users', 'bio')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('users', sa.Column('bio', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column('users', sa.Column('pass_secure', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column('users', sa.Column('profile_pic_path', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.create_index('ix_users_username', 'users', ['username'], unique=False)
    op.drop_column('users', 'pass_hash')
    op.add_column('pitches', sa.Column('pitch_category', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column('pitches', sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('pitches', sa.Column('pitch_content', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'pitches', type_='foreignkey')
    op.create_foreign_key('pitches_user_id_fkey', 'pitches', 'users', ['user_id'], ['id'])
    op.drop_column('pitches', 'title')
    op.drop_column('pitches', 'description')
    op.drop_column('pitches', 'comments_id')
    op.add_column('comments', sa.Column('comment_content', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.add_column('comments', sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('comments', sa.Column('pitch_id', sa.INTEGER(), autoincrement=False, nullable=True))
    op.create_foreign_key('comments_user_id_fkey', 'comments', 'users', ['user_id'], ['id'])
    op.drop_column('comments', 'name')
    # ### end Alembic commands ###
