Files
pablan/backend/alembic/versions/c4f7a1b2e9d3_document_reviewer.py
ProfessorNovaandClaude Opus 5 784b76baf7 Pablan, as it stands
Self-hosted knowledge management for SMEs: a split-screen Markdown editor
whose sections an LLM refines while you write, and RAG question answering
over the documents that result. FastAPI + Postgres/pgvector on the back,
SvelteKit on the front, everything OpenAI-compatible and self-hostable.

Squashed into a single commit; the development history stays local.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CA43ZJda8Rbp2hKXNy8f6b
2026-09-04 09:21:37 +02:00

43 lines
1.1 KiB
Python

"""document reviewer
An author can delegate approval: `documents.reviewer_id` names the user asked
to review a pending document. Nullable (self-approval leaves it null), SET NULL
so a document survives the reviewer leaving.
Revision ID: c4f7a1b2e9d3
Revises: a71e3c92fd45
Create Date: 2026-07-22 00:00:00.000000
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "c4f7a1b2e9d3"
down_revision: Union[str, Sequence[str], None] = "a71e3c92fd45"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
"""Upgrade schema."""
op.add_column("documents", sa.Column("reviewer_id", sa.Uuid(), nullable=True))
op.create_foreign_key(
"documents_reviewer_id_fkey",
"documents",
"users",
["reviewer_id"],
["id"],
ondelete="SET NULL",
)
def downgrade() -> None:
"""Downgrade schema."""
op.drop_constraint("documents_reviewer_id_fkey", "documents", type_="foreignkey")
op.drop_column("documents", "reviewer_id")