"""add host_paths to managed_repos

Revision ID: g4b5c6d7e8f9
Revises: f3a4b5c6d7e8
Create Date: 2026-03-16

Adds a JSONB column `host_paths` to managed_repos mapping hostname → absolute
local path. This allows the same repo to be registered at different paths on
different machines (e.g. /home/worsch/marki-docx on the workstation and
/home/tegwick/marki-docx on custodiancore). The consistency checker and any
other path-resolving code prefers host_paths[current_hostname] over local_path.
"""
from __future__ import annotations

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

revision = "g4b5c6d7e8f9"
down_revision = "f3a4b5c6d7e8"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.add_column(
        "managed_repos",
        sa.Column(
            "host_paths",
            postgresql.JSONB(astext_type=sa.Text()),
            nullable=False,
            server_default="{}",
        ),
    )


def downgrade() -> None:
    op.drop_column("managed_repos", "host_paths")
