"""demo plugin: a user-owned note table with RLS (skeleton for SPEC §11.1 tests) Revision ID: demo0001 Revises: Create Date: 2026-07-26 """ from __future__ import annotations from collections.abc import Sequence from alembic import op from app.plugins.rls import enable_rls revision: str = "demo0001" down_revision: str | None = None branch_labels: str | Sequence[str] | None = None depends_on: str | Sequence[str] | None = None def upgrade() -> None: op.execute( "CREATE TABLE plg_demo_note (" "id uuid PRIMARY KEY DEFAULT gen_random_uuid(), " "user_id uuid NOT NULL, " "body text NOT NULL DEFAULT '')" ) # Per-user isolation enforced by Postgres (SPEC §11.1); every plg_ user-data # table calls this right after creation. enable_rls("plg_demo_note") def downgrade() -> None: op.execute("DROP TABLE IF EXISTS plg_demo_note")