"""empty message

Revision ID: 9adbee158e02
Revises: ffdc0a98111c
Create Date: 2021-07-01 22:12:13.283000

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '9adbee158e02'
down_revision = 'ffdc0a98111c'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        'subfeedits',
        sa.Column(
            'id',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'name',
            sa.String(length=40),
            nullable=True
        ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'posts',
        sa.Column(
            'id',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'title',
            sa.String(length=255),
            nullable=False
        ),
        sa.Column(
            'content',
            sa.String(length=1000),
            nullable=True
        ),
        sa.Column(
            'userId',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'subfeeditId',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'time',
            sa.DateTime(),
            nullable=False
        ),
        sa.ForeignKeyConstraint(['subfeeditId'], ['subfeedits.id'], ),
        sa.ForeignKeyConstraint(['userId'], ['users.id'], ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'subscriptions',
        sa.Column(
            'id',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'userId',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'subfeeditId',
            sa.Integer(),
            nullable=False
        ),
        sa.ForeignKeyConstraint(['subfeeditId'], ['subfeedits.id'], ),
        sa.ForeignKeyConstraint(['userId'], ['users.id'], ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'comments',
        sa.Column(
            'id',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'userId',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'postId',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'text',
            sa.String(length=1000),
            nullable=False
        ),
        sa.Column(
            'time',
            sa.DateTime(),
            nullable=False
        ),
        sa.ForeignKeyConstraint(['postId'], ['posts.id'], ),
        sa.ForeignKeyConstraint(['userId'], ['users.id'], ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'postvotes',
        sa.Column(
            'id',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'userId',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'postId',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'vote',
            sa.String(length=5),
            nullable=False
        ),
        sa.ForeignKeyConstraint(['postId'], ['posts.id'], ),
        sa.ForeignKeyConstraint(['userId'], ['users.id'], ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'commentvotes',
        sa.Column(
            'id',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'userId',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'commentId',
            sa.Integer(),
            nullable=False
        ),
        sa.Column(
            'vote',
            sa.String(length=5),
            nullable=False
        ),
        sa.ForeignKeyConstraint(['commentId'], ['comments.id'], ),
        sa.ForeignKeyConstraint(['userId'], ['users.id'], ),
        sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('commentvotes')
    op.drop_table('postvotes')
    op.drop_table('comments')
    op.drop_table('subscriptions')
    op.drop_table('posts')
    op.drop_table('subfeedits')
    # ### end Alembic commands ###
