"""drop ingest_run file_hash unique

Revision ID: 0002_drop_ingest_run_file_hash_unique
Revises: 0001_initial
Create Date: 2026-01-23 23:20:00.000000
"""

from alembic import op


revision = "0002_drop_ingest_run_file_hash_unique"
down_revision = "0001_initial"
branch_labels = None
depends_on = None


def upgrade() -> None:
    #Lets increase the version_num column of the alembic_version table to 120 characters
    op.execute("ALTER TABLE alembic_version ALTER COLUMN version_num TYPE character varying(120)")
    op.drop_constraint("ingest_run_file_hash_key", "ingest_run", type_="unique")


def downgrade() -> None:
    #Lets decrease the version_num column of the alembic_version table to 255 characters
    op.execute("ALTER TABLE alembic_version ALTER COLUMN version_num TYPE character varying(255)")
    op.create_unique_constraint("ingest_run_file_hash_key", "ingest_run", ["file_hash"])
