"""Add IgnoredUser table

Revision ID: dc43d91dc18a
Revises: 1b2abc79a5c6
Create Date: 2018-03-27 17:12:39.938445

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "dc43d91dc18a"
down_revision = "1b2abc79a5c6"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "ignored_user",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("created_at", sa.DateTime(), nullable=True),
        sa.Column("updated_at", sa.DateTime(), nullable=True),
        sa.Column("username", sa.String(length=64), nullable=True),
        sa.Column("raffle_id", sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(["raffle_id"], ["raffle.id"]),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(
        op.f("ix_ignored_user_raffle_id"), "ignored_user", ["raffle_id"], unique=False
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_ignored_user_raffle_id"), table_name="ignored_user")
    op.drop_table("ignored_user")
    # ### end Alembic commands ###
