# pylint: disable=invalid-name
"""OfflineBatchResultChangelog

Revision ID: 5238d088cf62
Revises: 95660eea5c1c
Create Date: 2020-11-12 05:03:21.855470+00:00

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "5238d088cf62"
down_revision = "95660eea5c1c"
branch_labels = None
depends_on = None


def upgrade():
    op.create_table(
        "offline_batch_result_changelog",
        sa.Column("created_at", sa.DateTime(), nullable=False),
        sa.Column("updated_at", sa.DateTime(), nullable=False),
        sa.Column("user_id", sa.String(length=200), nullable=False),
        sa.Column("jurisdiction_id", sa.String(length=200), nullable=False),
        sa.Column("before", sa.JSON(), nullable=False),
        sa.Column("after", sa.JSON(), nullable=False),
        sa.ForeignKeyConstraint(
            ["jurisdiction_id"],
            ["jurisdiction.id"],
            name=op.f("offline_batch_result_changelog_jurisdiction_id_fkey"),
            ondelete="cascade",
        ),
        sa.ForeignKeyConstraint(
            ["user_id"],
            ["user.id"],
            name=op.f("offline_batch_result_changelog_user_id_fkey"),
            ondelete="cascade",
        ),
        sa.PrimaryKeyConstraint(
            "jurisdiction_id",
            "user_id",
            "created_at",
            name=op.f("offline_batch_result_changelog_pkey"),
        ),
    )


def downgrade():  # pragma: no cover
    pass
    # ### commands auto generated by Alembic - please adjust! ###
    # op.drop_table("offline_batch_result_changelog")
    # ### end Alembic commands ###
