"""Added polls

Revision ID: cfb91e6aa9fc
Revises: cd4868f312c5
Create Date: 2021-02-19 21:08:25.065628

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('poll',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('type', sa.String(length=20), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('title', sa.UnicodeText(), nullable=True),
    sa.Column('start', sa.DateTime(), nullable=True),
    sa.Column('end', sa.DateTime(), nullable=True),
    sa.Column('choices', sa.PickleType(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['member.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('pollanswer',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('poll_id', sa.Integer(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('answer', sa.PickleType(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['member.id'], ),
    sa.ForeignKeyConstraint(['poll_id'], ['poll.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('pollanswer')
    op.drop_table('poll')
    # ### end Alembic commands ###
