Auto-mode commit 7aa33cd accidentally deleted 78 files (14,814 lines) during M005
execution. Subsequent commits rebuilt some frontend files but backend/, alembic/,
tests/, whisper/, docker configs, and prompts were never restored in this repo.
This commit restores the full project tree by syncing from ub01's working directory,
which has all M001-M007 features running in production containers.
Restored: backend/ (config, models, routers, database, redis, search_service, worker),
alembic/ (6 migrations), docker/ (Dockerfiles, nginx, compose), prompts/ (4 stages),
tests/, whisper/, README.md, .env.example, chrysopedia-spec.md
47 lines
1.9 KiB
Python
47 lines
1.9 KiB
Python
"""Create content_reports table.
|
|
|
|
Revision ID: 003_content_reports
|
|
Revises: 002_technique_page_versions
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
|
|
revision = "003_content_reports"
|
|
down_revision = "002_technique_page_versions"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"content_reports",
|
|
sa.Column("id", UUID(as_uuid=True), primary_key=True, server_default=sa.func.gen_random_uuid()),
|
|
sa.Column("content_type", sa.String(50), nullable=False),
|
|
sa.Column("content_id", UUID(as_uuid=True), nullable=True),
|
|
sa.Column("content_title", sa.String(500), nullable=True),
|
|
sa.Column("report_type", sa.Enum(
|
|
"inaccurate", "missing_info", "wrong_attribution", "formatting", "other",
|
|
name="report_type", create_constraint=True,
|
|
), nullable=False),
|
|
sa.Column("description", sa.Text(), nullable=False),
|
|
sa.Column("status", sa.Enum(
|
|
"open", "acknowledged", "resolved", "dismissed",
|
|
name="report_status", create_constraint=True,
|
|
), nullable=False, server_default="open"),
|
|
sa.Column("admin_notes", sa.Text(), nullable=True),
|
|
sa.Column("page_url", sa.String(1000), nullable=True),
|
|
sa.Column("created_at", sa.DateTime(), server_default=sa.func.now(), nullable=False),
|
|
sa.Column("resolved_at", sa.DateTime(), nullable=True),
|
|
)
|
|
|
|
op.create_index("ix_content_reports_status_created", "content_reports", ["status", "created_at"])
|
|
op.create_index("ix_content_reports_content", "content_reports", ["content_type", "content_id"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_content_reports_content")
|
|
op.drop_index("ix_content_reports_status_created")
|
|
op.drop_table("content_reports")
|
|
sa.Enum(name="report_status").drop(op.get_bind(), checkfirst=True)
|
|
sa.Enum(name="report_type").drop(op.get_bind(), checkfirst=True)
|