"""git sources: admin-managed list of git repo URLs Revision ID: 0006 Revises: 0005 Create Date: 2026-08-26 Phase 35 (git-sources-admin story, A13 — one additive, reversible table, no other schema change): * ``git_sources`` — one row per admin-managed git source URL. The admin page (``/git-sources.html``) maintains the list that the Sync button (phase 32) and ``import_docs`` (phase 28) clone/pull. DB rows win over the ``BOR_GIT_SOURCES`` env var, which stays a fallback while the table is empty (once the table has rows it is ignored — the UI is the source of truth). ``url`` is unique (``uq_git_sources_url``); ``added_at`` is stamped server-side and orders the list oldest-first. """ from __future__ import annotations import sqlalchemy as sa from sqlalchemy.dialects import postgresql from alembic import op revision = "0006" down_revision = "0005" branch_labels = None depends_on = None def upgrade() -> None: op.create_table( "git_sources", sa.Column("id", postgresql.UUID(as_uuid=True), primary_key=True), sa.Column("url", sa.Text(), nullable=False), sa.Column( "added_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False, ), ) op.create_index("uq_git_sources_url", "git_sources", ["url"], unique=True) def downgrade() -> None: op.drop_index("uq_git_sources_url", table_name="git_sources") op.drop_table("git_sources")