# pylint: disable=invalid-name
"""Election.sample_preview

Revision ID: 848ffc831a04
Revises: 754cca3f4448
Create Date: 2023-09-13 21:39:09.062655+00:00

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "848ffc831a04"
down_revision = "754cca3f4448"
branch_labels = None
depends_on = None


def upgrade():
    op.add_column("election", sa.Column("sample_preview", sa.JSON(), nullable=True))
    op.add_column(
        "election",
        sa.Column("sample_preview_task_id", sa.String(length=200), nullable=True),
    )
    op.create_foreign_key(
        op.f("election_sample_preview_task_id_fkey"),
        "election",
        "background_task",
        ["sample_preview_task_id"],
        ["id"],
        ondelete="set null",
    )


def downgrade():  # pragma: no cover
    pass
    # # ### commands auto generated by Alembic - please adjust! ###
    # op.drop_constraint(op.f('election_sample_preview_task_id_fkey'), 'election', type_='foreignkey')
    # op.drop_column('election', 'sample_preview_task_id')
    # op.drop_column('election', 'sample_preview')
    # # ### end Alembic commands ###
