"""remove category column

Revision ID: ee<PASSWORD>
Revises: <PASSWORD>
Create Date: 2019-06-30 21:28:54.817969

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

# revision identifiers, used by Alembic.
revision = 'ee8<PASSWORD>a865f9'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comments',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('body', sa.String(), nullable=True),
    sa.Column('published_at', sa.DateTime(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['post_id'], ['post.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('post', sa.Column('author', sa.String(length=255), nullable=True))
    op.add_column('post', sa.Column('category', sa.String(length=255), nullable=True))
    op.add_column('post', sa.Column('downvote', sa.Integer(), nullable=True))
    op.add_column('post', sa.Column('post_content', sa.String(), nullable=True))
    op.add_column('post', sa.Column('published_at', sa.DateTime(), nullable=True))
    op.add_column('post', sa.Column('upvote', sa.Integer(), nullable=True))
    op.alter_column('post', 'title',
               existing_type=sa.VARCHAR(length=100),
               nullable=True)
    op.alter_column('post', 'user_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.drop_column('post', 'date_posted')
    op.drop_column('post', 'content')
    op.add_column('user', sa.Column('bio', sa.String(length=255), nullable=True))
    op.add_column('user', sa.Column('password_hash', sa.String(length=255), nullable=True))
    op.add_column('user', sa.Column('profile_pic_path', sa.String(), nullable=True))
    op.alter_column('user', 'email',
               existing_type=sa.VARCHAR(length=120),
               nullable=True)
    op.alter_column('user', 'username',
               existing_type=sa.VARCHAR(length=20),
               nullable=True)
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=False)
    op.drop_constraint('user_email_key', 'user', type_='unique')
    op.drop_constraint('user_username_key', 'user', type_='unique')
    op.drop_column('user', 'image_file')
    op.drop_column('user', 'password')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('password', sa.VARCHAR(length=60), autoincrement=False, nullable=False))
    op.add_column('user', sa.Column('image_file', sa.VARCHAR(length=20), autoincrement=False, nullable=False))
    op.create_unique_constraint('user_username_key', 'user', ['username'])
    op.create_unique_constraint('user_email_key', 'user', ['email'])
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.alter_column('user', 'username',
               existing_type=sa.VARCHAR(length=20),
               nullable=False)
    op.alter_column('user', 'email',
               existing_type=sa.VARCHAR(length=120),
               nullable=False)
    op.drop_column('user', 'profile_pic_path')
    op.drop_column('user', 'password_hash')
    op.drop_column('user', 'bio')
    op.add_column('post', sa.Column('content', sa.TEXT(), autoincrement=False, nullable=False))
    op.add_column('post', sa.Column('date_posted', postgresql.TIMESTAMP(), autoincrement=False, nullable=False))
    op.alter_column('post', 'user_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    op.alter_column('post', 'title',
               existing_type=sa.VARCHAR(length=100),
               nullable=False)
    op.drop_column('post', 'upvote')
    op.drop_column('post', 'published_at')
    op.drop_column('post', 'post_content')
    op.drop_column('post', 'downvote')
    op.drop_column('post', 'category')
    op.drop_column('post', 'author')
    op.drop_table('comments')
    # ### end Alembic commands ###

"""remove category column

Revision ID: ee<PASSWORD>
Revises: <PASSWORD>
Create Date: 2019-06-30 21:28:54.817969

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

# revision identifiers, used by Alembic.
revision = 'ee8<PASSWORD>a865f9'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comments',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('body', sa.String(), nullable=True),
    sa.Column('published_at', sa.DateTime(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['post_id'], ['post.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('post', sa.Column('author', sa.String(length=255), nullable=True))
    op.add_column('post', sa.Column('category', sa.String(length=255), nullable=True))
    op.add_column('post', sa.Column('downvote', sa.Integer(), nullable=True))
    op.add_column('post', sa.Column('post_content', sa.String(), nullable=True))
    op.add_column('post', sa.Column('published_at', sa.DateTime(), nullable=True))
    op.add_column('post', sa.Column('upvote', sa.Integer(), nullable=True))
    op.alter_column('post', 'title',
               existing_type=sa.VARCHAR(length=100),
               nullable=True)
    op.alter_column('post', 'user_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.drop_column('post', 'date_posted')
    op.drop_column('post', 'content')
    op.add_column('user', sa.Column('bio', sa.String(length=255), nullable=True))
    op.add_column('user', sa.Column('password_hash', sa.String(length=255), nullable=True))
    op.add_column('user', sa.Column('profile_pic_path', sa.String(), nullable=True))
    op.alter_column('user', 'email',
               existing_type=sa.VARCHAR(length=120),
               nullable=True)
    op.alter_column('user', 'username',
               existing_type=sa.VARCHAR(length=20),
               nullable=True)
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=False)
    op.drop_constraint('user_email_key', 'user', type_='unique')
    op.drop_constraint('user_username_key', 'user', type_='unique')
    op.drop_column('user', 'image_file')
    op.drop_column('user', 'password')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('password', sa.VARCHAR(length=60), autoincrement=False, nullable=False))
    op.add_column('user', sa.Column('image_file', sa.VARCHAR(length=20), autoincrement=False, nullable=False))
    op.create_unique_constraint('user_username_key', 'user', ['username'])
    op.create_unique_constraint('user_email_key', 'user', ['email'])
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.alter_column('user', 'username',
               existing_type=sa.VARCHAR(length=20),
               nullable=False)
    op.alter_column('user', 'email',
               existing_type=sa.VARCHAR(length=120),
               nullable=False)
    op.drop_column('user', 'profile_pic_path')
    op.drop_column('user', 'password_hash')
    op.drop_column('user', 'bio')
    op.add_column('post', sa.Column('content', sa.TEXT(), autoincrement=False, nullable=False))
    op.add_column('post', sa.Column('date_posted', postgresql.TIMESTAMP(), autoincrement=False, nullable=False))
    op.alter_column('post', 'user_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    op.alter_column('post', 'title',
               existing_type=sa.VARCHAR(length=100),
               nullable=False)
    op.drop_column('post', 'upvote')
    op.drop_column('post', 'published_at')
    op.drop_column('post', 'post_content')
    op.drop_column('post', 'downvote')
    op.drop_column('post', 'category')
    op.drop_column('post', 'author')
    op.drop_table('comments')
    # ### end Alembic commands ###

remove category column  Revision ID: ee<PASSWORD> Revises: <PASSWORD> Create Date: 2019-06-30 21:28:54.817969 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###