-- Phase 06 #22 — Per-user plugin enablement + config blob. -- -- Adds the PluginUserConfig table referenced by docs/improvement-plan/ -- 06-plugin-system/hooks-lifecycle.md. When a plugin needs per-user -- opt-in or per-user settings (Slack-channel-per-user etc.) the host -- writes a row here and the hook producer respects `enabled` before -- invoking the plugin for that user. CREATE TABLE "PluginUserConfig" ( "id" TEXT NOT NULL, "pluginId" TEXT NOT NULL, "userId" TEXT NOT NULL, "enabled" BOOLEAN NOT NULL DEFAULT true, "configJson" JSONB, "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, "updatedAt" TIMESTAMP(3) NOT NULL, CONSTRAINT "PluginUserConfig_pkey" PRIMARY KEY ("id") ); CREATE UNIQUE INDEX "PluginUserConfig_pluginId_userId_key" ON "PluginUserConfig" ("pluginId", "userId"); CREATE INDEX "PluginUserConfig_userId_idx" ON "PluginUserConfig" ("userId"); ALTER TABLE "PluginUserConfig" ADD CONSTRAINT "PluginUserConfig_pluginId_fkey" FOREIGN KEY ("pluginId") REFERENCES "Plugin" ("id") ON DELETE CASCADE ON UPDATE CASCADE;