redditraffler/redditraffler

View on GitHub
app/db/migrations/versions/6e2f1d9ef98c_drop_ignoreduser_table.py

Summary

Maintainability
A
0 mins
Test Coverage
"""Drop IgnoredUser table

Revision ID: 6e2f1d9ef98c
Revises: 9cfa830d9291
Create Date: 2019-04-10 21:30:59.575049

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

# revision identifiers, used by Alembic.
revision = "6e2f1d9ef98c"
down_revision = "9cfa830d9291"
branch_labels = None
depends_on = None


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


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "ignored_user",
        sa.Column("id", sa.INTEGER(), nullable=False),
        sa.Column(
            "created_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
        ),
        sa.Column(
            "updated_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
        ),
        sa.Column(
            "username", sa.VARCHAR(length=64), autoincrement=False, nullable=True
        ),
        sa.Column("raffle_id", sa.INTEGER(), autoincrement=False, nullable=False),
        sa.ForeignKeyConstraint(
            ["raffle_id"], ["raffle.id"], name="ignored_user_raffle_id_fkey"
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(
        "ix_ignored_user_raffle_id", "ignored_user", ["raffle_id"], unique=False
    )
    # ### end Alembic commands ###