"""add plugin_kv (SPEC §11 plugin namespaced key/value store) Core-owned table backing ``plugin_kv(plugin, user_id, key)`` — the light-state store every plugin gets (SPEC §11). Not a ``plg_``-prefixed plugin-owned table; plugin-owned tables ship in each plugin's own Alembic branch (§11.1). Revision ID: 0013 Revises: 0012 Create Date: 2026-07-26 """ from __future__ import annotations from collections.abc import Sequence from alembic import op revision: str = "0013" down_revision: str | None = "0012" branch_labels: str | Sequence[str] | None = None depends_on: str | Sequence[str] | None = None def upgrade() -> None: op.execute( """ CREATE TABLE plugin_kv ( plugin text NOT NULL, user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE, key text NOT NULL, value jsonb NOT NULL, PRIMARY KEY (plugin, user_id, key) ) """ ) def downgrade() -> None: op.execute("DROP TABLE IF EXISTS plugin_kv")