"""added upvoted

Revision ID: 6dca8c020d2d
Revises: 
Create Date: 2021-02-17 18:03:15.218694

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '6dca8c020d2d'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('upvotes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('question_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['question_id'], ['questions.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('questions', sa.Column('correct_answer_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'questions', 'answers', ['correct_answer_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'questions', type_='foreignkey')
    op.drop_column('questions', 'correct_answer_id')
    op.drop_table('upvotes')
    # ### end Alembic commands ###

7221e063c276b4e3bde593227d48303999911fef
<mask token>


def downgrade():
    op.drop_constraint(None, 'questions', type_='foreignkey')
    op.drop_column('questions', 'correct_answer_id')
    op.drop_table('upvotes')

<mask token>


def upgrade():
    op.create_table('upvotes', sa.Column('id', sa.Integer(), nullable=False
        ), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column(
        'question_id', sa.Integer(), nullable=True), sa.
        ForeignKeyConstraint(['question_id'], ['questions.id']), sa.
        ForeignKeyConstraint(['user_id'], ['users.id']), sa.
        PrimaryKeyConstraint('id'))
    op.add_column('questions', sa.Column('correct_answer_id', sa.Integer(),
        nullable=True))
    op.create_foreign_key(None, 'questions', 'answers', [
        'correct_answer_id'], ['id'])


def downgrade():
    op.drop_constraint(None, 'questions', type_='foreignkey')
    op.drop_column('questions', 'correct_answer_id')
    op.drop_table('upvotes')

<mask token>
revision = '6dca8c020d2d'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    op.create_table('upvotes', sa.Column('id', sa.Integer(), nullable=False
        ), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column(
        'question_id', sa.Integer(), nullable=True), sa.
        ForeignKeyConstraint(['question_id'], ['questions.id']), sa.
        ForeignKeyConstraint(['user_id'], ['users.id']), sa.
        PrimaryKeyConstraint('id'))
    op.add_column('questions', sa.Column('correct_answer_id', sa.Integer(),
        nullable=True))
    op.create_foreign_key(None, 'questions', 'answers', [
        'correct_answer_id'], ['id'])


def downgrade():
    op.drop_constraint(None, 'questions', type_='foreignkey')
    op.drop_column('questions', 'correct_answer_id')
    op.drop_table('upvotes')

<mask token>
from alembic import op
import sqlalchemy as sa
revision = '6dca8c020d2d'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    op.create_table('upvotes', sa.Column('id', sa.Integer(), nullable=False
        ), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column(
        'question_id', sa.Integer(), nullable=True), sa.
        ForeignKeyConstraint(['question_id'], ['questions.id']), sa.
        ForeignKeyConstraint(['user_id'], ['users.id']), sa.
        PrimaryKeyConstraint('id'))
    op.add_column('questions', sa.Column('correct_answer_id', sa.Integer(),
        nullable=True))
    op.create_foreign_key(None, 'questions', 'answers', [
        'correct_answer_id'], ['id'])


def downgrade():
    op.drop_constraint(None, 'questions', type_='foreignkey')
    op.drop_column('questions', 'correct_answer_id')
    op.drop_table('upvotes')

"""added upvoted

Revision ID: 6dca8c020d2d
Revises: 
Create Date: 2021-02-17 18:03:15.218694

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '6dca8c020d2d'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('upvotes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('question_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['question_id'], ['questions.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.add_column('questions', sa.Column('correct_answer_id', sa.Integer(), nullable=True))
    op.create_foreign_key(None, 'questions', 'answers', ['correct_answer_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'questions', type_='foreignkey')
    op.drop_column('questions', 'correct_answer_id')
    op.drop_table('upvotes')
    # ### end Alembic commands ###
