Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
+35
@@ -0,0 +1,35 @@
|
||||
-- Phase 06 / F-001 — Explicit per-tenant capability consent.
|
||||
--
|
||||
-- One row per (tenantId, pluginId, capabilityName) — the operator's
|
||||
-- approval that this plugin may invoke this capability for this tenant.
|
||||
-- The lifecycle service refuses to flip Plugin.enabled to true until
|
||||
-- every manifest-declared capability has a matching row.
|
||||
--
|
||||
-- `scopeJson` is the operator-approved scope; null means "use the
|
||||
-- manifest-declared scope verbatim".
|
||||
|
||||
CREATE TABLE "TenantPluginCapabilityGrant" (
|
||||
"id" TEXT NOT NULL,
|
||||
"tenantId" TEXT NOT NULL,
|
||||
"pluginId" TEXT NOT NULL,
|
||||
"capabilityName" TEXT NOT NULL,
|
||||
"scopeJson" JSONB,
|
||||
"grantedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"grantedByUserId" TEXT,
|
||||
CONSTRAINT "TenantPluginCapabilityGrant_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX "TenantPluginCapabilityGrant_tenant_plugin_cap_key"
|
||||
ON "TenantPluginCapabilityGrant" ("tenantId", "pluginId", "capabilityName");
|
||||
|
||||
CREATE INDEX "TenantPluginCapabilityGrant_tenant_plugin_idx"
|
||||
ON "TenantPluginCapabilityGrant" ("tenantId", "pluginId");
|
||||
|
||||
-- FK to Plugin via (tenantId, pluginId) — matches the Plugin model's
|
||||
-- @@unique constraint, not the Plugin primary key.
|
||||
ALTER TABLE "TenantPluginCapabilityGrant"
|
||||
ADD CONSTRAINT "TenantPluginCapabilityGrant_plugin_fkey"
|
||||
FOREIGN KEY ("pluginId", "tenantId")
|
||||
REFERENCES "Plugin"("pluginId", "tenantId")
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
Reference in new issue
Block a user