"""refactor service queue

Revision ID: 1ebfc89accb9
Revises: fac12b982c1c
Create Date: 2021-12-16 14:01:11.333690

"""

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

# revision identifiers, used by Alembic.
revision = "1ebfc89accb9"
down_revision = "fac12b982c1c"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column("service_queue", "priority", existing_type=sa.INTEGER(), nullable=False)
    op.alter_column("service_queue", "created_on", nullable=False)
    op.alter_column("service_queue", "record_id", nullable=False)
    op.drop_constraint("service_queue_tasks_record_id_fkey", "service_queue_tasks", type_="foreignkey")
    op.create_foreign_key(None, "service_queue_tasks", "base_record", ["record_id"], ["id"])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    raise RuntimeError("Cannot downgrade")
