"""Users and pitch changes

Revision ID: ff2aeab22c7b
Revises: 36d7e307135b
Create Date: 2019-07-01 07:38:51.291891

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = 'ff2aeab22c7b'
down_revision = '36d7e307135b'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('pitch')
    op.add_column('pitches', sa.Column('posted_at', sa.DateTime(), nullable=True))
    op.add_column('pitches', sa.Column('text', sa.Text(), nullable=True))
    op.create_index(op.f('ix_pitches_posted_at'), 'pitches', ['posted_at'], unique=False)
    op.drop_column('pitches', 'pitch_content')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('pitches', sa.Column('pitch_content', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.drop_index(op.f('ix_pitches_posted_at'), table_name='pitches')
    op.drop_column('pitches', 'text')
    op.drop_column('pitches', 'posted_at')
    op.create_table('pitch',
    sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('pitch_title', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('category', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
    sa.Column('pitch_body', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.Column('posted_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('posted_by', sa.VARCHAR(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='pitch_user_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='pitch_pkey')
    )
    # ### end Alembic commands ###
