@hivemagnus/magnus-server 0.0.0-stage → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +171 -0
- package/LICENSE +202 -0
- package/README.md +169 -2
- package/agent-version.json +1 -0
- package/dist/ai/HEARTBEAT.md +56 -0
- package/dist/ai/IDENTITY.md +54 -0
- package/dist/ai/MEMORY.md +40 -0
- package/dist/ai/TOOLS.md +538 -0
- package/dist/ai/USER.md +32 -0
- package/dist/cli/args.js +62 -0
- package/dist/cli/env-catalog.js +131 -0
- package/dist/cli/preflight.js +89 -0
- package/dist/cli.js +175 -0
- package/dist/config/cors.js +16 -0
- package/dist/config/env.js +392 -0
- package/dist/config/features.js +16 -0
- package/dist/config/index.js +3 -0
- package/dist/config/listener-security.js +38 -0
- package/dist/config/version.js +31 -0
- package/dist/db/client.js +44 -0
- package/dist/db/generated/prisma/browser.js +18 -0
- package/dist/db/generated/prisma/client.js +35 -0
- package/dist/db/generated/prisma/commonInputTypes.js +11 -0
- package/dist/db/generated/prisma/enums.js +42 -0
- package/dist/db/generated/prisma/internal/class.js +50 -0
- package/dist/db/generated/prisma/internal/prismaNamespace.js +1598 -0
- package/dist/db/generated/prisma/internal/prismaNamespaceBrowser.js +1569 -0
- package/dist/db/generated/prisma/models/A2ATask.js +2 -0
- package/dist/db/generated/prisma/models/AdmissionFence.js +2 -0
- package/dist/db/generated/prisma/models/Agent.js +2 -0
- package/dist/db/generated/prisma/models/AiConversation.js +2 -0
- package/dist/db/generated/prisma/models/AiDashboard.js +2 -0
- package/dist/db/generated/prisma/models/AiMemory.js +2 -0
- package/dist/db/generated/prisma/models/AiMessage.js +2 -0
- package/dist/db/generated/prisma/models/AiScheduledOp.js +2 -0
- package/dist/db/generated/prisma/models/AlertConditionState.js +2 -0
- package/dist/db/generated/prisma/models/AlertRule.js +2 -0
- package/dist/db/generated/prisma/models/AlertViolation.js +2 -0
- package/dist/db/generated/prisma/models/AnomalyEvent.js +2 -0
- package/dist/db/generated/prisma/models/ApplicationObservation.js +2 -0
- package/dist/db/generated/prisma/models/ArdentInstallation.js +2 -0
- package/dist/db/generated/prisma/models/ArdentProfile.js +2 -0
- package/dist/db/generated/prisma/models/ArdentScopeEnrollment.js +2 -0
- package/dist/db/generated/prisma/models/CommandResourceFence.js +2 -0
- package/dist/db/generated/prisma/models/CommandResourceLease.js +2 -0
- package/dist/db/generated/prisma/models/CommandResult.js +2 -0
- package/dist/db/generated/prisma/models/CronJob.js +2 -0
- package/dist/db/generated/prisma/models/CronJobExecution.js +2 -0
- package/dist/db/generated/prisma/models/DeployJob.js +2 -0
- package/dist/db/generated/prisma/models/DriftScan.js +2 -0
- package/dist/db/generated/prisma/models/EngineeringMetricSample.js +2 -0
- package/dist/db/generated/prisma/models/EngineeringRecoveryExercise.js +2 -0
- package/dist/db/generated/prisma/models/ExecutionRun.js +2 -0
- package/dist/db/generated/prisma/models/FilePatchTask.js +2 -0
- package/dist/db/generated/prisma/models/GpuSnapshot.js +2 -0
- package/dist/db/generated/prisma/models/HealthSnapshot.js +2 -0
- package/dist/db/generated/prisma/models/HermesCoreRollout.js +2 -0
- package/dist/db/generated/prisma/models/HermesCoreRolloutHost.js +2 -0
- package/dist/db/generated/prisma/models/HermesCredentialPool.js +2 -0
- package/dist/db/generated/prisma/models/HermesCredentialPoolAttachment.js +2 -0
- package/dist/db/generated/prisma/models/HermesCronJob.js +2 -0
- package/dist/db/generated/prisma/models/HermesHook.js +2 -0
- package/dist/db/generated/prisma/models/HermesInstallation.js +2 -0
- package/dist/db/generated/prisma/models/HermesMcpServer.js +2 -0
- package/dist/db/generated/prisma/models/HermesMcpServerAttachment.js +2 -0
- package/dist/db/generated/prisma/models/HermesMessagingBinding.js +2 -0
- package/dist/db/generated/prisma/models/HermesOperationJob.js +2 -0
- package/dist/db/generated/prisma/models/HermesPluginInstall.js +2 -0
- package/dist/db/generated/prisma/models/HermesProfile.js +2 -0
- package/dist/db/generated/prisma/models/HermesProviderConfig.js +2 -0
- package/dist/db/generated/prisma/models/HermesRegistryClient.js +2 -0
- package/dist/db/generated/prisma/models/HermesRegistryInventory.js +2 -0
- package/dist/db/generated/prisma/models/HermesRegistryReceipt.js +2 -0
- package/dist/db/generated/prisma/models/HermesRegistryRevision.js +2 -0
- package/dist/db/generated/prisma/models/HermesRegistryTarget.js +2 -0
- package/dist/db/generated/prisma/models/HermesRole.js +2 -0
- package/dist/db/generated/prisma/models/HermesRoleApplication.js +2 -0
- package/dist/db/generated/prisma/models/HermesSkillAssignment.js +2 -0
- package/dist/db/generated/prisma/models/HermesToolsetPolicy.js +2 -0
- package/dist/db/generated/prisma/models/IncidentLesson.js +2 -0
- package/dist/db/generated/prisma/models/LibraryCategory.js +2 -0
- package/dist/db/generated/prisma/models/LibraryFile.js +2 -0
- package/dist/db/generated/prisma/models/LogEntry.js +2 -0
- package/dist/db/generated/prisma/models/MagnusReleaseCanary.js +2 -0
- package/dist/db/generated/prisma/models/MaintenanceWindow.js +2 -0
- package/dist/db/generated/prisma/models/ManagedCronDefinition.js +2 -0
- package/dist/db/generated/prisma/models/ManagedCronOccurrence.js +2 -0
- package/dist/db/generated/prisma/models/Node.js +2 -0
- package/dist/db/generated/prisma/models/Notification.js +2 -0
- package/dist/db/generated/prisma/models/NotificationPreference.js +2 -0
- package/dist/db/generated/prisma/models/RemediationExecution.js +2 -0
- package/dist/db/generated/prisma/models/RemediationRule.js +2 -0
- package/dist/db/generated/prisma/models/RemoteCommand.js +2 -0
- package/dist/db/generated/prisma/models/ResourceDrainParticipant.js +2 -0
- package/dist/db/generated/prisma/models/ResourceEnrollment.js +2 -0
- package/dist/db/generated/prisma/models/ResourceParticipantWork.js +2 -0
- package/dist/db/generated/prisma/models/Role.js +2 -0
- package/dist/db/generated/prisma/models/RoleApplication.js +2 -0
- package/dist/db/generated/prisma/models/RolloutTarget.js +2 -0
- package/dist/db/generated/prisma/models/SecurityExportOutbox.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionAction.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionActionApproval.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCase.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCaseActivity.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCaseEntity.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCaseEvent.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCaseRelationship.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCollector.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionCommandOutbox.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionDeletionReceipt.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionDelivery.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionEntity.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionEntityAlias.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionEvent.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionEventEntity.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionEvidence.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionInvestigation.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionNonce.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionReceiptChainHead.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionRuleVersion.js +2 -0
- package/dist/db/generated/prisma/models/SecurityFusionSourceState.js +2 -0
- package/dist/db/generated/prisma/models/SecurityServiceState.js +2 -0
- package/dist/db/generated/prisma/models/SharedResourceFence.js +2 -0
- package/dist/db/generated/prisma/models/SharedResourceLease.js +2 -0
- package/dist/db/generated/prisma/models/SharedResourceLeaseResource.js +2 -0
- package/dist/db/generated/prisma/models/SkillInstallation.js +2 -0
- package/dist/db/generated/prisma/models/SkillRegistryEntry.js +2 -0
- package/dist/db/generated/prisma/models/SkillTag.js +2 -0
- package/dist/db/generated/prisma/models/SkillVersion.js +2 -0
- package/dist/db/generated/prisma/models/TeamApprovalDecision.js +2 -0
- package/dist/db/generated/prisma/models/User.js +2 -0
- package/dist/db/generated/prisma/models/WebhookDelivery.js +2 -0
- package/dist/db/generated/prisma/models/WebhookEndpoint.js +2 -0
- package/dist/db/generated/prisma/models.js +2 -0
- package/dist/db/index.js +3 -0
- package/dist/db/read-retry.js +35 -0
- package/dist/db/seed.js +348 -0
- package/dist/index.js +162 -0
- package/dist/middleware/auth.js +361 -0
- package/dist/middleware/body-limit.js +14 -0
- package/dist/middleware/correlation-id.js +13 -0
- package/dist/middleware/error-handler.js +28 -0
- package/dist/middleware/iam-token.js +21 -0
- package/dist/middleware/rate-limit.js +78 -0
- package/dist/middleware/request-logger.js +85 -0
- package/dist/middleware/security-headers.js +23 -0
- package/dist/middleware/tracing.js +120 -0
- package/dist/middleware/user-status.js +33 -0
- package/dist/openapi/spec.js +2656 -0
- package/dist/queue/redis.js +20 -0
- package/dist/queue/requeue.js +27 -0
- package/dist/queue/workers.js +342 -0
- package/dist/routes/ai-schedule.js +73 -0
- package/dist/routes/alerts.js +79 -0
- package/dist/routes/anomalies.js +101 -0
- package/dist/routes/ardent.js +82 -0
- package/dist/routes/assistant.js +417 -0
- package/dist/routes/audit.js +138 -0
- package/dist/routes/codex.js +65 -0
- package/dist/routes/commands.js +226 -0
- package/dist/routes/credentials.js +58 -0
- package/dist/routes/cron.js +292 -0
- package/dist/routes/dependencies.js +49 -0
- package/dist/routes/deploy.js +18 -0
- package/dist/routes/discovery.js +168 -0
- package/dist/routes/docs.js +24 -0
- package/dist/routes/drift.js +126 -0
- package/dist/routes/events-stream.js +87 -0
- package/dist/routes/files.js +214 -0
- package/dist/routes/fleet-checks.js +21 -0
- package/dist/routes/health.js +133 -0
- package/dist/routes/heartbeat.js +545 -0
- package/dist/routes/hermes-registry.js +278 -0
- package/dist/routes/hermes.js +61 -0
- package/dist/routes/library.js +402 -0
- package/dist/routes/logs.js +172 -0
- package/dist/routes/managed-cron.js +23 -0
- package/dist/routes/mcp.js +39 -0
- package/dist/routes/metrics.js +187 -0
- package/dist/routes/nodes.js +951 -0
- package/dist/routes/notifications.js +130 -0
- package/dist/routes/ops.js +258 -0
- package/dist/routes/orchestra.js +430 -0
- package/dist/routes/predictions.js +23 -0
- package/dist/routes/profiling.js +68 -0
- package/dist/routes/quick-command.js +72 -0
- package/dist/routes/remediation.js +111 -0
- package/dist/routes/resource-leases.js +297 -0
- package/dist/routes/roles.js +370 -0
- package/dist/routes/rollout.js +124 -0
- package/dist/routes/scan.js +116 -0
- package/dist/routes/security-backup.js +58 -0
- package/dist/routes/security-fusion.js +605 -0
- package/dist/routes/security-integration.js +71 -0
- package/dist/routes/self-update.js +129 -0
- package/dist/routes/shared-resource-leases.js +78 -0
- package/dist/routes/skills.js +485 -0
- package/dist/routes/stats.js +96 -0
- package/dist/routes/team-approvals.js +23 -0
- package/dist/routes/terminal-ticket.js +15 -0
- package/dist/routes/terminal.js +17 -0
- package/dist/routes/topology.js +37 -0
- package/dist/routes/users.js +219 -0
- package/dist/routes/webhooks.js +137 -0
- package/dist/schemas/command-reconciliation.js +14 -0
- package/dist/schemas/commands.js +51 -0
- package/dist/schemas/cron.js +33 -0
- package/dist/schemas/deploy.js +20 -0
- package/dist/schemas/files.js +14 -0
- package/dist/schemas/hermes.js +69 -0
- package/dist/schemas/index.js +11 -0
- package/dist/schemas/library.js +48 -0
- package/dist/schemas/logs.js +35 -0
- package/dist/schemas/managed-cron.js +127 -0
- package/dist/schemas/node-responses.js +87 -0
- package/dist/schemas/node-session-receipt.js +84 -0
- package/dist/schemas/nodes.js +36 -0
- package/dist/schemas/orchestra.js +118 -0
- package/dist/schemas/resource-participant-reconciliation.js +99 -0
- package/dist/schemas/roles.js +54 -0
- package/dist/schemas/shared-resource-lease.js +132 -0
- package/dist/schemas/skills.js +44 -0
- package/dist/schemas/users.js +28 -0
- package/dist/scripts/run-disposable-recovery-exercise.js +39 -0
- package/dist/sdk/index.js +2 -0
- package/dist/sdk/node-api-client.js +474 -0
- package/dist/security/approval-assertion.js +66 -0
- package/dist/security/command-completion-registry.js +35 -0
- package/dist/security/command-request.js +12 -0
- package/dist/security/command-result-signature.js +34 -0
- package/dist/security/managed-http.js +45 -0
- package/dist/security/native-completion-registry.js +44 -0
- package/dist/server.js +178 -0
- package/dist/services/admission-fence.js +71 -0
- package/dist/services/ai-assistant-service.js +2523 -0
- package/dist/services/ai-correlation-service.js +225 -0
- package/dist/services/ai-export-service.js +141 -0
- package/dist/services/ai-insights-service.js +219 -0
- package/dist/services/ai-schedule-service.js +145 -0
- package/dist/services/ai-scratchpad-service.js +222 -0
- package/dist/services/ai-tools.js +1343 -0
- package/dist/services/alert-service.js +313 -0
- package/dist/services/anomaly-detector.js +419 -0
- package/dist/services/api-local-work.js +79 -0
- package/dist/services/application-probes.js +309 -0
- package/dist/services/ardent-scope-enrollment.js +123 -0
- package/dist/services/ardent-service.js +86 -0
- package/dist/services/audit-service.js +308 -0
- package/dist/services/codex-service.js +209 -0
- package/dist/services/command-lifecycle.js +60 -0
- package/dist/services/command-resource-leases.js +305 -0
- package/dist/services/control-host-node.js +242 -0
- package/dist/services/credential-rotation-service.js +294 -0
- package/dist/services/dependency-service.js +145 -0
- package/dist/services/disposable-recovery-runner.js +595 -0
- package/dist/services/docker-group-health.js +121 -0
- package/dist/services/engineering-assurance.js +492 -0
- package/dist/services/engineering-evidence-ledger.js +94 -0
- package/dist/services/engineering-metric-evidence.js +26 -0
- package/dist/services/event-bus.js +227 -0
- package/dist/services/fleet-check-log.js +102 -0
- package/dist/services/forecast-service.js +154 -0
- package/dist/services/health-retention.js +175 -0
- package/dist/services/heartbeat-stream.js +63 -0
- package/dist/services/hermes-catalog-import.js +62 -0
- package/dist/services/hermes-cli-parser.js +671 -0
- package/dist/services/hermes-core-rollout.js +90 -0
- package/dist/services/hermes-dashboard-endpoint.js +13 -0
- package/dist/services/hermes-plugin-source.js +149 -0
- package/dist/services/hermes-registry-service.js +258 -0
- package/dist/services/hermes-service.js +566 -0
- package/dist/services/hivemem-client.js +85 -0
- package/dist/services/host-local-writer.js +82 -0
- package/dist/services/incident-evidence.js +110 -0
- package/dist/services/incident-lessons.js +186 -0
- package/dist/services/llm-providers/anthropic.js +143 -0
- package/dist/services/llm-providers/index.js +7 -0
- package/dist/services/llm-providers/llama-cpp.js +237 -0
- package/dist/services/llm-providers/ollama.js +292 -0
- package/dist/services/llm-providers/openai-compatible.js +200 -0
- package/dist/services/llm-providers/provider-error.js +36 -0
- package/dist/services/llm-providers/registry.js +45 -0
- package/dist/services/llm-providers/types.js +2 -0
- package/dist/services/log-emitter.js +19 -0
- package/dist/services/log-retention.js +66 -0
- package/dist/services/maintenance-service.js +29 -0
- package/dist/services/managed-cron.js +493 -0
- package/dist/services/managed-ssh-admission.js +68 -0
- package/dist/services/monitor-pulse.js +10 -0
- package/dist/services/node-issue-monitor.js +71 -0
- package/dist/services/node-service.js +35 -0
- package/dist/services/notification-retention.js +51 -0
- package/dist/services/notification-service.js +94 -0
- package/dist/services/operational-observations.js +112 -0
- package/dist/services/operations-config.js +67 -0
- package/dist/services/ops-service.js +491 -0
- package/dist/services/orchestra-extras-service.js +370 -0
- package/dist/services/orchestra-resources-service.js +530 -0
- package/dist/services/os-scheduler-writer.js +73 -0
- package/dist/services/password-service.js +22 -0
- package/dist/services/prediction-service.js +284 -0
- package/dist/services/recovery-exercises.js +682 -0
- package/dist/services/remediation-service.js +325 -0
- package/dist/services/resource-enrollment.js +433 -0
- package/dist/services/resource-node-lock.js +18 -0
- package/dist/services/resource-participant-work.js +302 -0
- package/dist/services/role-service.js +388 -0
- package/dist/services/rollout-service.js +440 -0
- package/dist/services/security-export.js +185 -0
- package/dist/services/security-fusion-actions.js +22 -0
- package/dist/services/security-fusion-approvals.js +83 -0
- package/dist/services/security-fusion-evidence-integrity.js +144 -0
- package/dist/services/security-fusion-ingest.js +101 -0
- package/dist/services/security-fusion-outbox.js +185 -0
- package/dist/services/security-fusion-receipt-chain.js +134 -0
- package/dist/services/security-fusion-service.js +751 -0
- package/dist/services/security-fusion-verification.js +50 -0
- package/dist/services/self-update-service.js +200 -0
- package/dist/services/shared-resource-leases.js +413 -0
- package/dist/services/skill-publication-bundle.js +90 -0
- package/dist/services/skill-publication-settlement.js +36 -0
- package/dist/services/skill-publication-state.js +40 -0
- package/dist/services/skill-registry-service.js +327 -0
- package/dist/services/skill-service.js +148 -0
- package/dist/services/ssh-exec-service.js +139 -0
- package/dist/services/ssh-host-verification.js +27 -0
- package/dist/services/tailscale-node-key-service.js +75 -0
- package/dist/services/team-approvals.js +118 -0
- package/dist/services/topology-service.js +138 -0
- package/dist/services/transfer-authority-snapshot.js +151 -0
- package/dist/services/webhook-credential-migration.js +97 -0
- package/dist/services/webhook-security.js +242 -0
- package/dist/services/webhook-service.js +494 -0
- package/dist/types/auth.js +3 -0
- package/dist/types/index.js +3 -0
- package/dist/types/library.js +3 -0
- package/dist/types/notifications.js +3 -0
- package/dist/types/roles.js +3 -0
- package/dist/types/shared-contracts.js +3 -0
- package/dist/utils/env.js +141 -0
- package/dist/utils/heartbeat-peer.js +19 -0
- package/dist/utils/idempotency.js +45 -0
- package/dist/utils/ip.js +25 -0
- package/dist/utils/json-fields.js +94 -0
- package/dist/utils/local-tls.js +39 -0
- package/dist/utils/magnus-home.js +15 -0
- package/dist/utils/node-url.js +59 -0
- package/dist/utils/redact.js +26 -0
- package/dist/utils/safe-equal.js +13 -0
- package/dist/utils/sentinel-nodes.js +16 -0
- package/dist/utils/validate.js +41 -0
- package/package.json +119 -4
- package/prisma/migrations/20261031000000_baseline/migration.sql +2935 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +2185 -0
- package/prisma.config.ts +14 -0
|
@@ -0,0 +1,2935 @@
|
|
|
1
|
+
-- Magnus server 1.0.0 baseline schema (PostgreSQL).
|
|
2
|
+
--
|
|
3
|
+
-- Beyond what Prisma models, this migration carries database-enforced
|
|
4
|
+
-- invariants: trigger functions and triggers guarding resource leases, fences
|
|
5
|
+
-- and append-only tables, CHECK constraints, partial unique indexes, and a few
|
|
6
|
+
-- seeded base rows.
|
|
7
|
+
|
|
8
|
+
CREATE TYPE public."AgentStatus" AS ENUM (
|
|
9
|
+
'RUNNING',
|
|
10
|
+
'STOPPED',
|
|
11
|
+
'UPDATING',
|
|
12
|
+
'ERROR'
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
CREATE TYPE public."CommandStatus" AS ENUM (
|
|
16
|
+
'PENDING',
|
|
17
|
+
'QUEUED',
|
|
18
|
+
'RUNNING',
|
|
19
|
+
'COMPLETED',
|
|
20
|
+
'FAILED',
|
|
21
|
+
'TIMEOUT',
|
|
22
|
+
'CANCELLED'
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
CREATE TYPE public."CronJobStatus" AS ENUM (
|
|
26
|
+
'ACTIVE',
|
|
27
|
+
'PAUSED',
|
|
28
|
+
'ERROR'
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
CREATE TYPE public."NodeStatus" AS ENUM (
|
|
32
|
+
'ONLINE',
|
|
33
|
+
'OFFLINE',
|
|
34
|
+
'DEGRADED',
|
|
35
|
+
'PROVISIONING',
|
|
36
|
+
'DECOMMISSIONED'
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
CREATE TYPE public."UserRole" AS ENUM (
|
|
40
|
+
'ADMIN',
|
|
41
|
+
'OPERATOR',
|
|
42
|
+
'VIEWER'
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
CREATE FUNCTION public.magnus_assert_shared_resource_consistency(checked_lease_id text) RETURNS void
|
|
46
|
+
LANGUAGE plpgsql
|
|
47
|
+
AS $$
|
|
48
|
+
BEGIN
|
|
49
|
+
IF EXISTS (
|
|
50
|
+
SELECT 1 FROM "shared_resource_leases" lease
|
|
51
|
+
WHERE lease."id" = checked_lease_id
|
|
52
|
+
AND (NOT EXISTS (SELECT 1 FROM "shared_resource_lease_resources" claim WHERE claim."leaseId" = lease."id")
|
|
53
|
+
OR EXISTS (SELECT 1 FROM "shared_resource_lease_resources" claim
|
|
54
|
+
WHERE claim."leaseId" = lease."id" AND claim."state" <> lease."state")
|
|
55
|
+
OR lease."resourceSetBinding" IS DISTINCT FROM (
|
|
56
|
+
SELECT string_agg(claim."resourceKey" || '=' || claim."fenceGeneration"::TEXT, E'\n' ORDER BY claim."resourceKey")
|
|
57
|
+
FROM "shared_resource_lease_resources" claim WHERE claim."leaseId" = lease."id"
|
|
58
|
+
))
|
|
59
|
+
) THEN
|
|
60
|
+
RAISE EXCEPTION 'shared resource lease and claim states must remain complete and identical';
|
|
61
|
+
END IF;
|
|
62
|
+
END;
|
|
63
|
+
$$;
|
|
64
|
+
|
|
65
|
+
CREATE FUNCTION public.magnus_check_shared_resource_claim_consistency() RETURNS trigger
|
|
66
|
+
LANGUAGE plpgsql
|
|
67
|
+
AS $$
|
|
68
|
+
BEGIN
|
|
69
|
+
PERFORM "magnus_assert_shared_resource_consistency"(COALESCE(NEW."leaseId", OLD."leaseId"));
|
|
70
|
+
RETURN NULL;
|
|
71
|
+
END;
|
|
72
|
+
$$;
|
|
73
|
+
|
|
74
|
+
CREATE FUNCTION public.magnus_check_shared_resource_lease_consistency() RETURNS trigger
|
|
75
|
+
LANGUAGE plpgsql
|
|
76
|
+
AS $$
|
|
77
|
+
BEGIN
|
|
78
|
+
PERFORM "magnus_assert_shared_resource_consistency"(COALESCE(NEW."id", OLD."id"));
|
|
79
|
+
RETURN NULL;
|
|
80
|
+
END;
|
|
81
|
+
$$;
|
|
82
|
+
|
|
83
|
+
CREATE FUNCTION public.magnus_enforce_shared_resource_claim_insert() RETURNS trigger
|
|
84
|
+
LANGUAGE plpgsql
|
|
85
|
+
AS $$
|
|
86
|
+
DECLARE
|
|
87
|
+
authoritative_generation BIGINT;
|
|
88
|
+
BEGIN
|
|
89
|
+
IF NEW."state" <> 'reserved' THEN
|
|
90
|
+
RAISE EXCEPTION 'shared resource claim must be born reserved';
|
|
91
|
+
END IF;
|
|
92
|
+
SELECT fence."generation" INTO authoritative_generation
|
|
93
|
+
FROM "shared_resource_fences" fence
|
|
94
|
+
WHERE fence."resourceKey" = NEW."resourceKey"
|
|
95
|
+
FOR SHARE;
|
|
96
|
+
IF authoritative_generation IS NULL
|
|
97
|
+
OR NEW."fenceGeneration" IS DISTINCT FROM authoritative_generation
|
|
98
|
+
THEN
|
|
99
|
+
RAISE EXCEPTION 'shared resource claim must bind the current authoritative fence generation';
|
|
100
|
+
END IF;
|
|
101
|
+
RETURN NEW;
|
|
102
|
+
END;
|
|
103
|
+
$$;
|
|
104
|
+
|
|
105
|
+
CREATE FUNCTION public.magnus_enforce_shared_resource_claim_transition() RETURNS trigger
|
|
106
|
+
LANGUAGE plpgsql
|
|
107
|
+
AS $$
|
|
108
|
+
BEGIN
|
|
109
|
+
IF NEW."leaseId" IS DISTINCT FROM OLD."leaseId"
|
|
110
|
+
OR NEW."resourceKey" IS DISTINCT FROM OLD."resourceKey"
|
|
111
|
+
OR NEW."fenceGeneration" IS DISTINCT FROM OLD."fenceGeneration"
|
|
112
|
+
THEN
|
|
113
|
+
RAISE EXCEPTION 'shared resource claim identity is immutable';
|
|
114
|
+
END IF;
|
|
115
|
+
IF (OLD."state" = 'released' AND NEW."state" <> 'released')
|
|
116
|
+
OR (OLD."state" = 'unknown' AND NEW."state" NOT IN ('unknown','released'))
|
|
117
|
+
OR (OLD."state" = 'running' AND NEW."state" NOT IN ('running','unknown','released'))
|
|
118
|
+
OR (OLD."state" = 'reserved' AND NEW."state" NOT IN ('reserved','running','released'))
|
|
119
|
+
THEN
|
|
120
|
+
RAISE EXCEPTION 'invalid shared resource claim transition';
|
|
121
|
+
END IF;
|
|
122
|
+
RETURN NEW;
|
|
123
|
+
END;
|
|
124
|
+
$$;
|
|
125
|
+
|
|
126
|
+
CREATE FUNCTION public.magnus_enforce_shared_resource_fence_generation() RETURNS trigger
|
|
127
|
+
LANGUAGE plpgsql
|
|
128
|
+
AS $$
|
|
129
|
+
BEGIN
|
|
130
|
+
IF NEW."resourceKey" IS DISTINCT FROM OLD."resourceKey" THEN
|
|
131
|
+
RAISE EXCEPTION 'shared resource fence identity is immutable';
|
|
132
|
+
END IF;
|
|
133
|
+
IF NEW."generation" <= OLD."generation" THEN
|
|
134
|
+
RAISE EXCEPTION 'shared resource fence generations must increase';
|
|
135
|
+
END IF;
|
|
136
|
+
RETURN NEW;
|
|
137
|
+
END;
|
|
138
|
+
$$;
|
|
139
|
+
|
|
140
|
+
CREATE FUNCTION public.magnus_enforce_shared_resource_fence_insert() RETURNS trigger
|
|
141
|
+
LANGUAGE plpgsql
|
|
142
|
+
AS $$
|
|
143
|
+
BEGIN
|
|
144
|
+
IF NEW."generation" <> 1 THEN
|
|
145
|
+
RAISE EXCEPTION 'shared resource fence history must begin at generation one';
|
|
146
|
+
END IF;
|
|
147
|
+
RETURN NEW;
|
|
148
|
+
END;
|
|
149
|
+
$$;
|
|
150
|
+
|
|
151
|
+
CREATE FUNCTION public.magnus_enforce_shared_resource_lease_insert() RETURNS trigger
|
|
152
|
+
LANGUAGE plpgsql
|
|
153
|
+
AS $_$
|
|
154
|
+
DECLARE
|
|
155
|
+
assertion JSONB;
|
|
156
|
+
issued_at BIGINT;
|
|
157
|
+
expires_at BIGINT;
|
|
158
|
+
BEGIN
|
|
159
|
+
IF NEW."state" <> 'reserved'
|
|
160
|
+
OR NEW."startedAt" IS NOT NULL
|
|
161
|
+
OR NEW."settledAt" IS NOT NULL
|
|
162
|
+
OR NEW."settlement" IS NOT NULL
|
|
163
|
+
OR NEW."evidenceSha256" IS NOT NULL
|
|
164
|
+
OR NEW."settlementRecordSha256" IS NOT NULL
|
|
165
|
+
OR NEW."terminalEvidenceJson" IS NOT NULL
|
|
166
|
+
OR NEW."reconciliationDecisionId" IS NOT NULL
|
|
167
|
+
OR NEW."reconciliationJson" IS NOT NULL
|
|
168
|
+
THEN
|
|
169
|
+
RAISE EXCEPTION 'shared resource lease must be born reserved without execution or settlement evidence';
|
|
170
|
+
END IF;
|
|
171
|
+
IF NEW."id" !~ '^[A-Za-z0-9_-]{16,64}$'
|
|
172
|
+
OR NEW."missionRootId" !~ '^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$'
|
|
173
|
+
OR NEW."taskId" !~ '^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$'
|
|
174
|
+
OR NEW."operationId" !~ '^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$'
|
|
175
|
+
OR NEW."ownerActor" !~ '^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$'
|
|
176
|
+
OR (NEW."callerKind" = 'delegated'
|
|
177
|
+
AND NEW."delegationId" !~ '^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$')
|
|
178
|
+
OR NEW."missionIssuer" !~ '^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$'
|
|
179
|
+
OR NEW."missionKeyId" !~ '^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$'
|
|
180
|
+
OR NEW."actionClass" NOT IN ('observe','analyze','create_artifact','create_draft',
|
|
181
|
+
'reversible_change','deploy','external_publish','destructive_response')
|
|
182
|
+
OR NEW."deadline" <= NEW."acquiredAt"
|
|
183
|
+
OR NEW."resourceSetBinding" = ''
|
|
184
|
+
THEN
|
|
185
|
+
RAISE EXCEPTION 'shared resource lease initial identity is invalid';
|
|
186
|
+
END IF;
|
|
187
|
+
BEGIN
|
|
188
|
+
assertion := NEW."missionAssertionJson"::JSONB;
|
|
189
|
+
EXCEPTION WHEN OTHERS THEN
|
|
190
|
+
RAISE EXCEPTION 'shared resource lease initial mission assertion is invalid';
|
|
191
|
+
END;
|
|
192
|
+
IF jsonb_typeof(assertion) <> 'object'
|
|
193
|
+
OR (SELECT count(*) FROM jsonb_object_keys(assertion)) <> 5
|
|
194
|
+
OR jsonb_typeof(assertion->'issuer') IS DISTINCT FROM 'string'
|
|
195
|
+
OR jsonb_typeof(assertion->'keyId') IS DISTINCT FROM 'string'
|
|
196
|
+
OR jsonb_typeof(assertion->'issuedAt') IS DISTINCT FROM 'number'
|
|
197
|
+
OR jsonb_typeof(assertion->'expiresAt') IS DISTINCT FROM 'number'
|
|
198
|
+
OR jsonb_typeof(assertion->'signature') IS DISTINCT FROM 'string'
|
|
199
|
+
OR assertion->>'issuer' IS DISTINCT FROM NEW."missionIssuer"
|
|
200
|
+
OR assertion->>'keyId' IS DISTINCT FROM NEW."missionKeyId"
|
|
201
|
+
OR COALESCE(assertion->>'issuedAt', '') !~ '^[1-9][0-9]{0,11}$'
|
|
202
|
+
OR COALESCE(assertion->>'expiresAt', '') !~ '^[1-9][0-9]{0,11}$'
|
|
203
|
+
OR COALESCE(assertion->>'signature', '') !~ '^[A-Za-z0-9+/]{80,128}={0,2}$'
|
|
204
|
+
OR NEW."missionAssertionSha256" IS DISTINCT FROM
|
|
205
|
+
encode(sha256(convert_to(NEW."missionAssertionJson", 'UTF8')), 'hex')
|
|
206
|
+
THEN
|
|
207
|
+
RAISE EXCEPTION 'shared resource lease initial mission assertion is invalid';
|
|
208
|
+
END IF;
|
|
209
|
+
issued_at := (assertion->>'issuedAt')::BIGINT;
|
|
210
|
+
expires_at := (assertion->>'expiresAt')::BIGINT;
|
|
211
|
+
IF expires_at <= issued_at OR expires_at > issued_at + 300 OR expires_at > 253402300799 THEN
|
|
212
|
+
RAISE EXCEPTION 'shared resource lease initial mission assertion is invalid';
|
|
213
|
+
END IF;
|
|
214
|
+
RETURN NEW;
|
|
215
|
+
END;
|
|
216
|
+
$_$;
|
|
217
|
+
|
|
218
|
+
CREATE FUNCTION public.magnus_enforce_shared_resource_lease_transition() RETURNS trigger
|
|
219
|
+
LANGUAGE plpgsql
|
|
220
|
+
AS $_$
|
|
221
|
+
BEGIN
|
|
222
|
+
IF NEW."id" IS DISTINCT FROM OLD."id"
|
|
223
|
+
OR NEW."missionRootId" IS DISTINCT FROM OLD."missionRootId"
|
|
224
|
+
OR NEW."missionRevision" IS DISTINCT FROM OLD."missionRevision"
|
|
225
|
+
OR NEW."taskId" IS DISTINCT FROM OLD."taskId"
|
|
226
|
+
OR NEW."operationId" IS DISTINCT FROM OLD."operationId"
|
|
227
|
+
OR NEW."requestSha256" IS DISTINCT FROM OLD."requestSha256"
|
|
228
|
+
OR NEW."actionClass" IS DISTINCT FROM OLD."actionClass"
|
|
229
|
+
OR NEW."ownerActor" IS DISTINCT FROM OLD."ownerActor"
|
|
230
|
+
OR NEW."callerKind" IS DISTINCT FROM OLD."callerKind"
|
|
231
|
+
OR NEW."delegationId" IS DISTINCT FROM OLD."delegationId"
|
|
232
|
+
OR NEW."missionIssuer" IS DISTINCT FROM OLD."missionIssuer"
|
|
233
|
+
OR NEW."missionKeyId" IS DISTINCT FROM OLD."missionKeyId"
|
|
234
|
+
OR NEW."missionAssertionSha256" IS DISTINCT FROM OLD."missionAssertionSha256"
|
|
235
|
+
OR NEW."missionAssertionJson" IS DISTINCT FROM OLD."missionAssertionJson"
|
|
236
|
+
OR NEW."resourceSetBinding" IS DISTINCT FROM OLD."resourceSetBinding"
|
|
237
|
+
OR NEW."deadline" IS DISTINCT FROM OLD."deadline"
|
|
238
|
+
OR NEW."acquiredAt" IS DISTINCT FROM OLD."acquiredAt"
|
|
239
|
+
THEN
|
|
240
|
+
RAISE EXCEPTION 'shared resource lease identity is immutable';
|
|
241
|
+
END IF;
|
|
242
|
+
IF OLD."state" = 'released' AND NEW."state" <> 'released' THEN
|
|
243
|
+
RAISE EXCEPTION 'released shared resource ownership cannot be revived';
|
|
244
|
+
END IF;
|
|
245
|
+
IF OLD."startedAt" IS NOT NULL AND NEW."startedAt" IS DISTINCT FROM OLD."startedAt" THEN
|
|
246
|
+
RAISE EXCEPTION 'shared resource lease start time is immutable';
|
|
247
|
+
END IF;
|
|
248
|
+
IF OLD."state" = 'released' AND (
|
|
249
|
+
NEW."startedAt" IS DISTINCT FROM OLD."startedAt"
|
|
250
|
+
OR NEW."settledAt" IS DISTINCT FROM OLD."settledAt"
|
|
251
|
+
OR NEW."settlement" IS DISTINCT FROM OLD."settlement"
|
|
252
|
+
OR NEW."evidenceSha256" IS DISTINCT FROM OLD."evidenceSha256"
|
|
253
|
+
OR NEW."settlementRecordSha256" IS DISTINCT FROM OLD."settlementRecordSha256"
|
|
254
|
+
OR NEW."terminalEvidenceJson" IS DISTINCT FROM OLD."terminalEvidenceJson"
|
|
255
|
+
OR NEW."reconciliationDecisionId" IS DISTINCT FROM OLD."reconciliationDecisionId"
|
|
256
|
+
OR NEW."reconciliationJson" IS DISTINCT FROM OLD."reconciliationJson"
|
|
257
|
+
) THEN
|
|
258
|
+
RAISE EXCEPTION 'released shared resource settlement is immutable';
|
|
259
|
+
END IF;
|
|
260
|
+
IF NEW."state" = 'released' THEN
|
|
261
|
+
IF NEW."settlement" LIKE 'signed-terminal:%' THEN
|
|
262
|
+
IF NEW."terminalEvidenceJson" IS NULL OR NEW."reconciliationDecisionId" IS NOT NULL
|
|
263
|
+
OR NEW."reconciliationJson" IS NOT NULL
|
|
264
|
+
OR COALESCE(NEW."terminalEvidenceJson"::jsonb->>'signature', '') !~ '^[A-Za-z0-9+/]{80,128}={0,2}$'
|
|
265
|
+
OR COALESCE(NEW."terminalEvidenceJson"::jsonb->>'issuer', '') !~ '^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$'
|
|
266
|
+
OR COALESCE(NEW."terminalEvidenceJson"::jsonb->>'keyId', '') !~ '^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$'
|
|
267
|
+
OR COALESCE(NEW."terminalEvidenceJson"::jsonb->>'outcome', '') NOT IN ('succeeded', 'failed', 'no_effect')
|
|
268
|
+
OR NEW."terminalEvidenceJson"::jsonb->>'missionRootId' IS DISTINCT FROM NEW."missionRootId"
|
|
269
|
+
OR (NEW."terminalEvidenceJson"::jsonb->>'missionRevision')::INTEGER IS DISTINCT FROM NEW."missionRevision"
|
|
270
|
+
OR NEW."terminalEvidenceJson"::jsonb->>'taskId' IS DISTINCT FROM NEW."taskId"
|
|
271
|
+
OR NEW."terminalEvidenceJson"::jsonb->>'operationId' IS DISTINCT FROM NEW."operationId"
|
|
272
|
+
OR NEW."terminalEvidenceJson"::jsonb->>'requestSha256' IS DISTINCT FROM NEW."requestSha256"
|
|
273
|
+
OR NEW."terminalEvidenceJson"::jsonb->>'actionClass' IS DISTINCT FROM NEW."actionClass"
|
|
274
|
+
OR NEW."terminalEvidenceJson"::jsonb->>'ownerActor' IS DISTINCT FROM NEW."ownerActor"
|
|
275
|
+
OR NEW."terminalEvidenceJson"::jsonb->>'evidenceSha256' IS DISTINCT FROM NEW."evidenceSha256"
|
|
276
|
+
OR (NEW."terminalEvidenceJson"::jsonb->>'version')::INTEGER IS DISTINCT FROM 1
|
|
277
|
+
OR (NEW."terminalEvidenceJson"::jsonb->>'deadline')::BIGINT IS DISTINCT FROM EXTRACT(EPOCH FROM NEW."deadline")::BIGINT
|
|
278
|
+
OR NEW."terminalEvidenceJson"::jsonb->'caller' IS DISTINCT FROM (CASE WHEN NEW."callerKind" = 'direct'
|
|
279
|
+
THEN jsonb_build_object('kind', 'direct')
|
|
280
|
+
ELSE jsonb_build_object('kind', 'delegated', 'delegationId', NEW."delegationId") END)
|
|
281
|
+
OR NEW."terminalEvidenceJson"::jsonb->'resources' IS DISTINCT FROM (
|
|
282
|
+
SELECT jsonb_agg(jsonb_build_object('resourceKey', claim."resourceKey",
|
|
283
|
+
'fenceGeneration', claim."fenceGeneration"::TEXT) ORDER BY claim."resourceKey")
|
|
284
|
+
FROM "shared_resource_lease_resources" claim WHERE claim."leaseId" = NEW."id"
|
|
285
|
+
)
|
|
286
|
+
OR NEW."settlement" IS DISTINCT FROM 'signed-terminal:' || (NEW."terminalEvidenceJson"::jsonb->>'outcome')
|
|
287
|
+
THEN
|
|
288
|
+
RAISE EXCEPTION 'released shared resource lease requires exact authenticated terminal evidence';
|
|
289
|
+
END IF;
|
|
290
|
+
ELSIF NEW."settlement" LIKE 'signed-reconciliation:%' THEN
|
|
291
|
+
IF NEW."reconciliationJson" IS NULL OR NEW."terminalEvidenceJson" IS NOT NULL
|
|
292
|
+
OR NEW."reconciliationDecisionId" IS NULL
|
|
293
|
+
OR COALESCE(NEW."reconciliationJson"::jsonb->>'signature', '') !~ '^[a-f0-9]{64}$'
|
|
294
|
+
OR NEW."reconciliationJson"::jsonb->>'missionRootId' IS DISTINCT FROM NEW."missionRootId"
|
|
295
|
+
OR (NEW."reconciliationJson"::jsonb->>'missionRevision')::INTEGER IS DISTINCT FROM NEW."missionRevision"
|
|
296
|
+
OR NEW."reconciliationJson"::jsonb->>'taskId' IS DISTINCT FROM NEW."taskId"
|
|
297
|
+
OR NEW."reconciliationJson"::jsonb->>'operationId' IS DISTINCT FROM NEW."operationId"
|
|
298
|
+
OR NEW."reconciliationJson"::jsonb->>'requestSha256' IS DISTINCT FROM NEW."requestSha256"
|
|
299
|
+
OR NEW."reconciliationJson"::jsonb->>'actionClass' IS DISTINCT FROM NEW."actionClass"
|
|
300
|
+
OR NEW."reconciliationJson"::jsonb->>'ownerActor' IS DISTINCT FROM NEW."ownerActor"
|
|
301
|
+
OR NEW."reconciliationJson"::jsonb->>'evidenceSha256' IS DISTINCT FROM NEW."evidenceSha256"
|
|
302
|
+
OR NEW."reconciliationJson"::jsonb->>'decisionId' IS DISTINCT FROM NEW."reconciliationDecisionId"
|
|
303
|
+
OR (NEW."reconciliationJson"::jsonb->>'version')::INTEGER IS DISTINCT FROM 1
|
|
304
|
+
OR (NEW."reconciliationJson"::jsonb->>'deadline')::BIGINT IS DISTINCT FROM EXTRACT(EPOCH FROM NEW."deadline")::BIGINT
|
|
305
|
+
OR NEW."reconciliationJson"::jsonb->'caller' IS DISTINCT FROM (CASE WHEN NEW."callerKind" = 'direct'
|
|
306
|
+
THEN jsonb_build_object('kind', 'direct')
|
|
307
|
+
ELSE jsonb_build_object('kind', 'delegated', 'delegationId', NEW."delegationId") END)
|
|
308
|
+
OR NEW."reconciliationJson"::jsonb->'resources' IS DISTINCT FROM (
|
|
309
|
+
SELECT jsonb_agg(jsonb_build_object('resourceKey', claim."resourceKey",
|
|
310
|
+
'fenceGeneration', claim."fenceGeneration"::TEXT) ORDER BY claim."resourceKey")
|
|
311
|
+
FROM "shared_resource_lease_resources" claim WHERE claim."leaseId" = NEW."id"
|
|
312
|
+
)
|
|
313
|
+
OR NEW."settlement" IS DISTINCT FROM 'signed-reconciliation:' || (NEW."reconciliationJson"::jsonb->>'disposition')
|
|
314
|
+
THEN
|
|
315
|
+
RAISE EXCEPTION 'released shared resource lease requires exact authenticated reconciliation evidence';
|
|
316
|
+
END IF;
|
|
317
|
+
ELSE
|
|
318
|
+
RAISE EXCEPTION 'released shared resource lease requires authenticated settlement evidence';
|
|
319
|
+
END IF;
|
|
320
|
+
END IF;
|
|
321
|
+
IF (OLD."state" = 'unknown' AND NEW."state" NOT IN ('unknown','released'))
|
|
322
|
+
OR (OLD."state" = 'running' AND NEW."state" NOT IN ('running','unknown','released'))
|
|
323
|
+
OR (OLD."state" = 'reserved' AND NEW."state" NOT IN ('reserved','running','released'))
|
|
324
|
+
THEN
|
|
325
|
+
RAISE EXCEPTION 'invalid shared resource lease transition';
|
|
326
|
+
END IF;
|
|
327
|
+
RETURN NEW;
|
|
328
|
+
END;
|
|
329
|
+
$_$;
|
|
330
|
+
|
|
331
|
+
CREATE FUNCTION public.magnus_reject_command_resource_authority_update() RETURNS trigger
|
|
332
|
+
LANGUAGE plpgsql
|
|
333
|
+
AS $$
|
|
334
|
+
BEGIN
|
|
335
|
+
IF NEW."id" IS DISTINCT FROM OLD."id"
|
|
336
|
+
OR NEW."nodeId" IS DISTINCT FROM OLD."nodeId"
|
|
337
|
+
OR NEW."resourceKey" IS DISTINCT FROM OLD."resourceKey"
|
|
338
|
+
OR NEW."serviceUnit" IS DISTINCT FROM OLD."serviceUnit"
|
|
339
|
+
OR NEW."commandId" IS DISTINCT FROM OLD."commandId"
|
|
340
|
+
OR NEW."ownerActor" IS DISTINCT FROM OLD."ownerActor"
|
|
341
|
+
OR NEW."requestSha256" IS DISTINCT FROM OLD."requestSha256"
|
|
342
|
+
OR NEW."coordinationJson" IS DISTINCT FROM OLD."coordinationJson"
|
|
343
|
+
OR NEW."directCommand" IS DISTINCT FROM OLD."directCommand"
|
|
344
|
+
OR NEW."deadline" IS DISTINCT FROM OLD."deadline"
|
|
345
|
+
OR NEW."completionClass" IS DISTINCT FROM OLD."completionClass"
|
|
346
|
+
OR NEW."completionRegistryVersion" IS DISTINCT FROM OLD."completionRegistryVersion"
|
|
347
|
+
OR NEW."completionRegistrySha256" IS DISTINCT FROM OLD."completionRegistrySha256"
|
|
348
|
+
OR NEW."completionDescriptorId" IS DISTINCT FROM OLD."completionDescriptorId"
|
|
349
|
+
OR NEW."completionOccurrenceId" IS DISTINCT FROM OLD."completionOccurrenceId"
|
|
350
|
+
OR NEW."completionSpecSha256" IS DISTINCT FROM OLD."completionSpecSha256"
|
|
351
|
+
THEN
|
|
352
|
+
RAISE EXCEPTION 'command resource authority is immutable';
|
|
353
|
+
END IF;
|
|
354
|
+
RETURN NEW;
|
|
355
|
+
END;
|
|
356
|
+
$$;
|
|
357
|
+
|
|
358
|
+
CREATE FUNCTION public.magnus_reject_recovery_exercise_update() RETURNS trigger
|
|
359
|
+
LANGUAGE plpgsql
|
|
360
|
+
AS $$
|
|
361
|
+
BEGIN
|
|
362
|
+
RAISE EXCEPTION 'engineering recovery exercise records are immutable';
|
|
363
|
+
END;
|
|
364
|
+
$$;
|
|
365
|
+
|
|
366
|
+
CREATE FUNCTION public.magnus_reject_resource_participant_identity_update() RETURNS trigger
|
|
367
|
+
LANGUAGE plpgsql
|
|
368
|
+
AS $$
|
|
369
|
+
BEGIN
|
|
370
|
+
IF NEW."workId" IS DISTINCT FROM OLD."workId"
|
|
371
|
+
OR NEW."nodeId" IS DISTINCT FROM OLD."nodeId"
|
|
372
|
+
OR NEW."nodeFqdn" IS DISTINCT FROM OLD."nodeFqdn"
|
|
373
|
+
OR NEW."participant" IS DISTINCT FROM OLD."participant"
|
|
374
|
+
OR NEW."ownerId" IS DISTINCT FROM OLD."ownerId"
|
|
375
|
+
OR NEW."kind" IS DISTINCT FROM OLD."kind"
|
|
376
|
+
OR NEW."epoch" IS DISTINCT FROM OLD."epoch"
|
|
377
|
+
OR NEW."barrierId" IS DISTINCT FROM OLD."barrierId"
|
|
378
|
+
OR NEW."requestSha256" IS DISTINCT FROM OLD."requestSha256"
|
|
379
|
+
OR NEW."operationSha256" IS DISTINCT FROM OLD."operationSha256"
|
|
380
|
+
OR NEW."fence" IS DISTINCT FROM OLD."fence"
|
|
381
|
+
OR NEW."deadline" IS DISTINCT FROM OLD."deadline"
|
|
382
|
+
THEN
|
|
383
|
+
RAISE EXCEPTION 'resource participant reservation identity is immutable';
|
|
384
|
+
END IF;
|
|
385
|
+
RETURN NEW;
|
|
386
|
+
END;
|
|
387
|
+
$$;
|
|
388
|
+
|
|
389
|
+
CREATE FUNCTION public.magnus_reject_shared_resource_claim_delete() RETURNS trigger
|
|
390
|
+
LANGUAGE plpgsql
|
|
391
|
+
AS $$
|
|
392
|
+
BEGIN
|
|
393
|
+
RAISE EXCEPTION 'shared resource claim history cannot be deleted or rewritten';
|
|
394
|
+
END;
|
|
395
|
+
$$;
|
|
396
|
+
|
|
397
|
+
CREATE FUNCTION public.magnus_reject_shared_resource_fence_delete() RETURNS trigger
|
|
398
|
+
LANGUAGE plpgsql
|
|
399
|
+
AS $$
|
|
400
|
+
BEGIN
|
|
401
|
+
RAISE EXCEPTION 'shared resource fence history cannot be deleted or reset';
|
|
402
|
+
END;
|
|
403
|
+
$$;
|
|
404
|
+
|
|
405
|
+
CREATE FUNCTION public.managed_cron_clear_acknowledgement_on_disable() RETURNS trigger
|
|
406
|
+
LANGUAGE plpgsql
|
|
407
|
+
AS $$
|
|
408
|
+
BEGIN
|
|
409
|
+
IF OLD."enabled" IS TRUE AND NEW."enabled" IS FALSE THEN
|
|
410
|
+
NEW."acknowledgementProtocolVersion" := NULL;
|
|
411
|
+
NEW."stageCommandSha256" := NULL;
|
|
412
|
+
NEW."stageReceiptSha256" := NULL;
|
|
413
|
+
NEW."stageAcknowledgedAt" := NULL;
|
|
414
|
+
NEW."activationCommandSha256" := NULL;
|
|
415
|
+
NEW."activationReceiptSha256" := NULL;
|
|
416
|
+
NEW."activationAcknowledgedAt" := NULL;
|
|
417
|
+
NEW."acknowledgedJobId" := NULL;
|
|
418
|
+
NEW."acknowledgedRevision" := NULL;
|
|
419
|
+
NEW."acknowledgedSpecSha256" := NULL;
|
|
420
|
+
NEW."acknowledgedSpecJson" := NULL;
|
|
421
|
+
END IF;
|
|
422
|
+
RETURN NEW;
|
|
423
|
+
END;
|
|
424
|
+
$$;
|
|
425
|
+
|
|
426
|
+
CREATE TABLE public.a2a_tasks (
|
|
427
|
+
id text NOT NULL,
|
|
428
|
+
title text DEFAULT ''::text NOT NULL,
|
|
429
|
+
description text DEFAULT ''::text NOT NULL,
|
|
430
|
+
status text DEFAULT 'submitted'::text NOT NULL,
|
|
431
|
+
"fromAgent" text DEFAULT 'user'::text NOT NULL,
|
|
432
|
+
"toAgent" text DEFAULT 'magnus'::text NOT NULL,
|
|
433
|
+
input text DEFAULT '{}'::text NOT NULL,
|
|
434
|
+
output text,
|
|
435
|
+
artifacts text DEFAULT '[]'::text NOT NULL,
|
|
436
|
+
history text DEFAULT '[]'::text NOT NULL,
|
|
437
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
438
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
439
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
440
|
+
);
|
|
441
|
+
|
|
442
|
+
CREATE TABLE public.agents (
|
|
443
|
+
id text NOT NULL,
|
|
444
|
+
"nodeId" text NOT NULL,
|
|
445
|
+
version text NOT NULL,
|
|
446
|
+
status public."AgentStatus" DEFAULT 'RUNNING'::public."AgentStatus" NOT NULL,
|
|
447
|
+
pid integer,
|
|
448
|
+
"startedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
449
|
+
"lastCheckIn" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
450
|
+
capabilities text DEFAULT '[]'::text NOT NULL
|
|
451
|
+
);
|
|
452
|
+
|
|
453
|
+
CREATE TABLE public.ai_conversations (
|
|
454
|
+
id text NOT NULL,
|
|
455
|
+
title text DEFAULT 'New conversation'::text NOT NULL,
|
|
456
|
+
type text DEFAULT 'chat'::text NOT NULL,
|
|
457
|
+
"nodeId" text,
|
|
458
|
+
"parentId" text,
|
|
459
|
+
"forkedFromMessageId" text,
|
|
460
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
461
|
+
summary text,
|
|
462
|
+
"createdBy" text DEFAULT 'system'::text NOT NULL,
|
|
463
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
464
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
465
|
+
);
|
|
466
|
+
|
|
467
|
+
CREATE TABLE public.ai_dashboards (
|
|
468
|
+
id text NOT NULL,
|
|
469
|
+
name text NOT NULL,
|
|
470
|
+
description text,
|
|
471
|
+
layout text DEFAULT '[]'::text NOT NULL,
|
|
472
|
+
"createdBy" text DEFAULT 'system'::text NOT NULL,
|
|
473
|
+
"isDefault" boolean DEFAULT false NOT NULL,
|
|
474
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
475
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
476
|
+
);
|
|
477
|
+
|
|
478
|
+
CREATE TABLE public.ai_memories (
|
|
479
|
+
id text NOT NULL,
|
|
480
|
+
key text NOT NULL,
|
|
481
|
+
category text DEFAULT 'general'::text NOT NULL,
|
|
482
|
+
content text NOT NULL,
|
|
483
|
+
source text DEFAULT 'heartbeat'::text NOT NULL,
|
|
484
|
+
relevance double precision DEFAULT 1.0 NOT NULL,
|
|
485
|
+
"accessedAt" timestamp(3) without time zone,
|
|
486
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
487
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
488
|
+
);
|
|
489
|
+
|
|
490
|
+
CREATE TABLE public.ai_messages (
|
|
491
|
+
id text NOT NULL,
|
|
492
|
+
"conversationId" text NOT NULL,
|
|
493
|
+
role text NOT NULL,
|
|
494
|
+
content text NOT NULL,
|
|
495
|
+
"toolCalls" text DEFAULT '[]'::text NOT NULL,
|
|
496
|
+
thinking text,
|
|
497
|
+
"structuredAnalysis" text,
|
|
498
|
+
"tokenCount" integer DEFAULT 0 NOT NULL,
|
|
499
|
+
"isRead" boolean DEFAULT false NOT NULL,
|
|
500
|
+
"readAt" timestamp(3) without time zone,
|
|
501
|
+
"pendingApproval" text,
|
|
502
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
503
|
+
);
|
|
504
|
+
|
|
505
|
+
CREATE TABLE public.ai_scheduled_ops (
|
|
506
|
+
id text NOT NULL,
|
|
507
|
+
name text NOT NULL,
|
|
508
|
+
description text DEFAULT ''::text NOT NULL,
|
|
509
|
+
"cronExpr" text NOT NULL,
|
|
510
|
+
enabled boolean DEFAULT true NOT NULL,
|
|
511
|
+
type text DEFAULT 'chat'::text NOT NULL,
|
|
512
|
+
prompt text NOT NULL,
|
|
513
|
+
"nodeId" text,
|
|
514
|
+
"createdBy" text NOT NULL,
|
|
515
|
+
"lastRunAt" timestamp(3) without time zone,
|
|
516
|
+
"nextRunAt" timestamp(3) without time zone,
|
|
517
|
+
"runCount" integer DEFAULT 0 NOT NULL,
|
|
518
|
+
"lastResult" text,
|
|
519
|
+
"lastError" text,
|
|
520
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
521
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
522
|
+
);
|
|
523
|
+
|
|
524
|
+
CREATE TABLE public.alert_condition_states (
|
|
525
|
+
"ruleId" text NOT NULL,
|
|
526
|
+
"nodeId" text NOT NULL,
|
|
527
|
+
"breachedAt" timestamp(3) without time zone NOT NULL,
|
|
528
|
+
"lastObservedAt" timestamp(3) without time zone NOT NULL,
|
|
529
|
+
"lastValue" double precision NOT NULL
|
|
530
|
+
);
|
|
531
|
+
|
|
532
|
+
CREATE TABLE public.alert_rules (
|
|
533
|
+
id text NOT NULL,
|
|
534
|
+
name text NOT NULL,
|
|
535
|
+
metric text NOT NULL,
|
|
536
|
+
operator text NOT NULL,
|
|
537
|
+
threshold double precision NOT NULL,
|
|
538
|
+
"durationSeconds" integer DEFAULT 0 NOT NULL,
|
|
539
|
+
severity text DEFAULT 'warning'::text NOT NULL,
|
|
540
|
+
"nodeFilter" text DEFAULT '*'::text NOT NULL,
|
|
541
|
+
active boolean DEFAULT true NOT NULL,
|
|
542
|
+
"cooldownMinutes" integer DEFAULT 15 NOT NULL,
|
|
543
|
+
"createdBy" text,
|
|
544
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
545
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
546
|
+
);
|
|
547
|
+
|
|
548
|
+
CREATE TABLE public.alert_violations (
|
|
549
|
+
id text NOT NULL,
|
|
550
|
+
"ruleId" text NOT NULL,
|
|
551
|
+
"nodeId" text NOT NULL,
|
|
552
|
+
"nodeName" text,
|
|
553
|
+
metric text NOT NULL,
|
|
554
|
+
value double precision NOT NULL,
|
|
555
|
+
threshold double precision NOT NULL,
|
|
556
|
+
severity text NOT NULL,
|
|
557
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
558
|
+
"resolvedAt" timestamp(3) without time zone,
|
|
559
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
560
|
+
);
|
|
561
|
+
|
|
562
|
+
CREATE TABLE public.anomaly_events (
|
|
563
|
+
id text NOT NULL,
|
|
564
|
+
"nodeId" text NOT NULL,
|
|
565
|
+
metric text NOT NULL,
|
|
566
|
+
value double precision NOT NULL,
|
|
567
|
+
"zScore" double precision NOT NULL,
|
|
568
|
+
mean double precision NOT NULL,
|
|
569
|
+
"stdDev" double precision NOT NULL,
|
|
570
|
+
severity text DEFAULT 'warning'::text NOT NULL,
|
|
571
|
+
resolved boolean DEFAULT false NOT NULL,
|
|
572
|
+
"resolvedAt" timestamp(3) without time zone,
|
|
573
|
+
"firstSeenAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
574
|
+
"lastSeenAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
575
|
+
"occurrenceCount" integer DEFAULT 1 NOT NULL,
|
|
576
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
577
|
+
"healthSnapshotId" text
|
|
578
|
+
);
|
|
579
|
+
|
|
580
|
+
CREATE TABLE public.application_observations (
|
|
581
|
+
id text NOT NULL,
|
|
582
|
+
"projectId" text NOT NULL,
|
|
583
|
+
"serviceId" text NOT NULL,
|
|
584
|
+
"nodeId" text NOT NULL,
|
|
585
|
+
status text DEFAULT 'unknown'::text NOT NULL,
|
|
586
|
+
"resultJson" text DEFAULT '{}'::text NOT NULL,
|
|
587
|
+
"observedAt" timestamp(3) without time zone
|
|
588
|
+
);
|
|
589
|
+
|
|
590
|
+
CREATE TABLE public.ardent_installations (
|
|
591
|
+
id text NOT NULL,
|
|
592
|
+
"nodeId" text NOT NULL,
|
|
593
|
+
owner text,
|
|
594
|
+
version text,
|
|
595
|
+
installed boolean DEFAULT false NOT NULL,
|
|
596
|
+
reachable boolean DEFAULT false NOT NULL,
|
|
597
|
+
error text,
|
|
598
|
+
"observedAt" timestamp(3) without time zone,
|
|
599
|
+
"checkedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
600
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
601
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
602
|
+
);
|
|
603
|
+
|
|
604
|
+
CREATE TABLE public.ardent_profiles (
|
|
605
|
+
id text NOT NULL,
|
|
606
|
+
"installationId" text NOT NULL,
|
|
607
|
+
name text NOT NULL,
|
|
608
|
+
"displayName" text NOT NULL,
|
|
609
|
+
backend text,
|
|
610
|
+
"apiPort" integer,
|
|
611
|
+
running boolean DEFAULT false NOT NULL,
|
|
612
|
+
"a2aEnabled" boolean DEFAULT false NOT NULL,
|
|
613
|
+
"telegramEnabled" boolean DEFAULT false NOT NULL,
|
|
614
|
+
error text,
|
|
615
|
+
"observedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
616
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
617
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
618
|
+
);
|
|
619
|
+
|
|
620
|
+
CREATE TABLE public.ardent_scope_enrollments (
|
|
621
|
+
"nodeId" text NOT NULL,
|
|
622
|
+
"nodeFqdn" text NOT NULL,
|
|
623
|
+
epoch integer NOT NULL,
|
|
624
|
+
"barrierId" text NOT NULL,
|
|
625
|
+
"decisionId" text NOT NULL,
|
|
626
|
+
"assertionJson" text NOT NULL,
|
|
627
|
+
"evidenceSha256" text NOT NULL,
|
|
628
|
+
"activatedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
629
|
+
);
|
|
630
|
+
|
|
631
|
+
CREATE TABLE public.command_resource_fences (
|
|
632
|
+
"resourceKey" text NOT NULL,
|
|
633
|
+
generation bigint DEFAULT 0 NOT NULL
|
|
634
|
+
);
|
|
635
|
+
|
|
636
|
+
CREATE TABLE public.command_resource_leases (
|
|
637
|
+
id text NOT NULL,
|
|
638
|
+
"nodeId" text NOT NULL,
|
|
639
|
+
"resourceKey" text NOT NULL,
|
|
640
|
+
"serviceUnit" text,
|
|
641
|
+
"commandId" text NOT NULL,
|
|
642
|
+
"ownerActor" text NOT NULL,
|
|
643
|
+
"requestSha256" text NOT NULL,
|
|
644
|
+
"coordinationJson" text NOT NULL,
|
|
645
|
+
state text DEFAULT 'reserved'::text NOT NULL,
|
|
646
|
+
"directCommand" boolean DEFAULT false NOT NULL,
|
|
647
|
+
deadline timestamp(3) without time zone NOT NULL,
|
|
648
|
+
"acquiredAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
649
|
+
"dispatchedAt" timestamp(3) without time zone,
|
|
650
|
+
"settledAt" timestamp(3) without time zone,
|
|
651
|
+
settlement text,
|
|
652
|
+
"evidenceSha256" text,
|
|
653
|
+
"completionClass" text,
|
|
654
|
+
"completionRegistryVersion" integer,
|
|
655
|
+
"completionRegistrySha256" text,
|
|
656
|
+
"completionDescriptorId" text,
|
|
657
|
+
"completionOccurrenceId" text,
|
|
658
|
+
"completionSpecSha256" text,
|
|
659
|
+
CONSTRAINT command_resource_leases_completion_authority_complete CHECK (((("completionClass" IS NULL) AND ("completionRegistryVersion" IS NULL) AND ("completionRegistrySha256" IS NULL) AND ("completionDescriptorId" IS NULL) AND ("completionOccurrenceId" IS NULL) AND ("completionSpecSha256" IS NULL)) OR (("completionClass" = ANY (ARRAY['node-supervised-command'::text, 'native-http'::text])) AND ("completionRegistryVersion" = 1) AND ("completionRegistrySha256" ~ '^[a-f0-9]{64}$'::text) AND ("completionDescriptorId" ~ '^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$'::text) AND ("completionOccurrenceId" IS NULL) AND ("completionSpecSha256" IS NULL)) OR (("completionClass" = 'managed-scheduler'::text) AND ("completionRegistryVersion" IS NULL) AND ("completionRegistrySha256" IS NULL) AND ("completionDescriptorId" IS NULL) AND ("completionOccurrenceId" ~ '^[a-f0-9]{64}$'::text) AND ("completionSpecSha256" ~ '^[a-f0-9]{64}$'::text)) OR (("completionClass" = 'unverified'::text) AND ("completionRegistryVersion" IS NULL) AND ("completionRegistrySha256" IS NULL) AND ("completionDescriptorId" IS NULL) AND ("completionOccurrenceId" IS NULL) AND ("completionSpecSha256" IS NULL)))),
|
|
660
|
+
CONSTRAINT command_resource_leases_state_check CHECK ((state = ANY (ARRAY['reserved'::text, 'running'::text, 'unknown'::text, 'released'::text])))
|
|
661
|
+
);
|
|
662
|
+
|
|
663
|
+
CREATE TABLE public.command_results (
|
|
664
|
+
id text NOT NULL,
|
|
665
|
+
"commandId" text NOT NULL,
|
|
666
|
+
"exitCode" integer NOT NULL,
|
|
667
|
+
stdout text NOT NULL,
|
|
668
|
+
stderr text NOT NULL,
|
|
669
|
+
"durationMs" integer NOT NULL,
|
|
670
|
+
truncated boolean DEFAULT false NOT NULL
|
|
671
|
+
);
|
|
672
|
+
|
|
673
|
+
CREATE TABLE public.council_admission_fences (
|
|
674
|
+
"nodeId" text NOT NULL,
|
|
675
|
+
"nodeFqdn" text NOT NULL,
|
|
676
|
+
"releaseId" text NOT NULL,
|
|
677
|
+
"closedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
678
|
+
);
|
|
679
|
+
|
|
680
|
+
CREATE TABLE public.cron_job_executions (
|
|
681
|
+
id text NOT NULL,
|
|
682
|
+
"cronJobId" text NOT NULL,
|
|
683
|
+
"nodeId" text NOT NULL,
|
|
684
|
+
"startedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
685
|
+
"completedAt" timestamp(3) without time zone,
|
|
686
|
+
"exitCode" integer,
|
|
687
|
+
stdout text NOT NULL,
|
|
688
|
+
stderr text NOT NULL,
|
|
689
|
+
"durationMs" integer
|
|
690
|
+
);
|
|
691
|
+
|
|
692
|
+
CREATE TABLE public.cron_jobs (
|
|
693
|
+
id text NOT NULL,
|
|
694
|
+
"nodeId" text NOT NULL,
|
|
695
|
+
name text NOT NULL,
|
|
696
|
+
description text DEFAULT ''::text NOT NULL,
|
|
697
|
+
schedule text NOT NULL,
|
|
698
|
+
command text NOT NULL,
|
|
699
|
+
args text DEFAULT '[]'::text NOT NULL,
|
|
700
|
+
"workingDirectory" text,
|
|
701
|
+
environment text DEFAULT '{}'::text NOT NULL,
|
|
702
|
+
"timeoutSeconds" integer DEFAULT 600 NOT NULL,
|
|
703
|
+
status public."CronJobStatus" DEFAULT 'ACTIVE'::public."CronJobStatus" NOT NULL,
|
|
704
|
+
"lastRunAt" timestamp(3) without time zone,
|
|
705
|
+
"lastRunExitCode" integer,
|
|
706
|
+
"nextRunAt" timestamp(3) without time zone,
|
|
707
|
+
"createdBy" text NOT NULL,
|
|
708
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
709
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
710
|
+
);
|
|
711
|
+
|
|
712
|
+
CREATE TABLE public.deploy_jobs (
|
|
713
|
+
id text NOT NULL,
|
|
714
|
+
type text NOT NULL,
|
|
715
|
+
status text DEFAULT 'running'::text NOT NULL,
|
|
716
|
+
concurrency integer DEFAULT 5 NOT NULL,
|
|
717
|
+
targets text NOT NULL,
|
|
718
|
+
results text,
|
|
719
|
+
"startedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
720
|
+
"completedAt" timestamp(3) without time zone,
|
|
721
|
+
"createdBy" text NOT NULL
|
|
722
|
+
);
|
|
723
|
+
|
|
724
|
+
CREATE TABLE public.drift_scans (
|
|
725
|
+
id text NOT NULL,
|
|
726
|
+
"nodeId" text NOT NULL,
|
|
727
|
+
"roleId" text,
|
|
728
|
+
status text NOT NULL,
|
|
729
|
+
findings text NOT NULL,
|
|
730
|
+
"scannedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
731
|
+
);
|
|
732
|
+
|
|
733
|
+
CREATE TABLE public.engineering_metric_samples (
|
|
734
|
+
id text NOT NULL,
|
|
735
|
+
"applicationId" text NOT NULL,
|
|
736
|
+
"nodeId" text NOT NULL,
|
|
737
|
+
metric text NOT NULL,
|
|
738
|
+
"sourceKey" text NOT NULL,
|
|
739
|
+
unit text NOT NULL,
|
|
740
|
+
value double precision NOT NULL,
|
|
741
|
+
"observedAt" timestamp(3) without time zone NOT NULL,
|
|
742
|
+
"probeContractSha256" text NOT NULL,
|
|
743
|
+
method text NOT NULL,
|
|
744
|
+
path text NOT NULL,
|
|
745
|
+
"httpStatus" integer NOT NULL,
|
|
746
|
+
"evidenceSha256" text NOT NULL,
|
|
747
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
748
|
+
CONSTRAINT engineering_metric_samples_http_status_check CHECK ((("httpStatus" >= 200) AND ("httpStatus" <= 399))),
|
|
749
|
+
CONSTRAINT engineering_metric_samples_method_check CHECK ((method = ANY (ARRAY['GET'::text, 'POST'::text]))),
|
|
750
|
+
CONSTRAINT engineering_metric_samples_metric_check CHECK ((metric = ANY (ARRAY['gpu_queue'::text, 'dependency_latency'::text]))),
|
|
751
|
+
CONSTRAINT engineering_metric_samples_path_check CHECK ((path ~ '^/[A-Za-z0-9/_.-]*$'::text)),
|
|
752
|
+
CONSTRAINT engineering_metric_samples_probe_digest_check CHECK (("probeContractSha256" ~ '^[a-f0-9]{64}$'::text)),
|
|
753
|
+
CONSTRAINT engineering_metric_samples_unit_check CHECK ((unit = ANY (ARRAY['jobs'::text, 'ms'::text]))),
|
|
754
|
+
CONSTRAINT engineering_metric_samples_value_check CHECK ((value >= (0)::double precision))
|
|
755
|
+
);
|
|
756
|
+
|
|
757
|
+
CREATE TABLE public.engineering_recovery_exercises (
|
|
758
|
+
id text NOT NULL,
|
|
759
|
+
"targetId" text NOT NULL,
|
|
760
|
+
scenario text NOT NULL,
|
|
761
|
+
"startedAt" timestamp(3) without time zone NOT NULL,
|
|
762
|
+
"recoveredAt" timestamp(3) without time zone NOT NULL,
|
|
763
|
+
"recoveryPointAt" timestamp(3) without time zone NOT NULL,
|
|
764
|
+
"rtoObjectiveSeconds" integer NOT NULL,
|
|
765
|
+
"rpoObjectiveSeconds" integer NOT NULL,
|
|
766
|
+
"beforeStateSha256" text NOT NULL,
|
|
767
|
+
"beforeTaskSha256" text NOT NULL,
|
|
768
|
+
"beforeArtifactSha256" text NOT NULL,
|
|
769
|
+
"afterStateSha256" text NOT NULL,
|
|
770
|
+
"afterTaskSha256" text NOT NULL,
|
|
771
|
+
"afterArtifactSha256" text NOT NULL,
|
|
772
|
+
"beforeEvidenceJson" text NOT NULL,
|
|
773
|
+
"afterEvidenceJson" text NOT NULL,
|
|
774
|
+
"runtimeEvidenceJson" text NOT NULL,
|
|
775
|
+
"directEvidenceSha256" text NOT NULL,
|
|
776
|
+
"runnerIssuer" text NOT NULL,
|
|
777
|
+
"runnerKeyId" text NOT NULL,
|
|
778
|
+
"runnerPublicKeySha256" text NOT NULL,
|
|
779
|
+
"runnerNonce" text NOT NULL,
|
|
780
|
+
"runnerIssuedAt" timestamp(3) without time zone NOT NULL,
|
|
781
|
+
"runnerExpiresAt" timestamp(3) without time zone NOT NULL,
|
|
782
|
+
"runnerExerciseContractSha256" text NOT NULL,
|
|
783
|
+
"runnerReceiptJson" text NOT NULL,
|
|
784
|
+
"runnerReceiptSha256" text NOT NULL,
|
|
785
|
+
"inventorySnapshotSha256" text NOT NULL,
|
|
786
|
+
"recordSha256" text NOT NULL,
|
|
787
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
788
|
+
CONSTRAINT engineering_recovery_exercises_chronology_check CHECK ((("recoveryPointAt" <= "startedAt") AND ("startedAt" <= "recoveredAt") AND ("recoveredAt" <= "runnerIssuedAt") AND ("runnerIssuedAt" <= "createdAt") AND ("createdAt" < "runnerExpiresAt"))),
|
|
789
|
+
CONSTRAINT engineering_recovery_exercises_digest_check CHECK ((("beforeStateSha256" ~ '^[a-f0-9]{64}$'::text) AND ("beforeTaskSha256" ~ '^[a-f0-9]{64}$'::text) AND ("beforeArtifactSha256" ~ '^[a-f0-9]{64}$'::text) AND ("afterStateSha256" ~ '^[a-f0-9]{64}$'::text) AND ("afterTaskSha256" ~ '^[a-f0-9]{64}$'::text) AND ("afterArtifactSha256" ~ '^[a-f0-9]{64}$'::text) AND ("directEvidenceSha256" ~ '^[a-f0-9]{64}$'::text) AND ("runnerPublicKeySha256" ~ '^[a-f0-9]{64}$'::text) AND ("runnerExerciseContractSha256" ~ '^[a-f0-9]{64}$'::text) AND ("runnerReceiptSha256" ~ '^[a-f0-9]{64}$'::text) AND ("inventorySnapshotSha256" ~ '^[a-f0-9]{64}$'::text) AND ("recordSha256" ~ '^[a-f0-9]{64}$'::text))),
|
|
790
|
+
CONSTRAINT engineering_recovery_exercises_objectives_check CHECK ((("rtoObjectiveSeconds" > 0) AND ("rpoObjectiveSeconds" >= 0))),
|
|
791
|
+
CONSTRAINT engineering_recovery_exercises_scenario_check CHECK ((scenario = ANY (ARRAY['backup_restore'::text, 'rollback'::text, 'specialist_loss'::text, 'coordinator_loss'::text]))),
|
|
792
|
+
CONSTRAINT engineering_recovery_exercises_target_check CHECK (("targetId" ~ '^disposable:[A-Za-z0-9._/-]{1,140}$'::text))
|
|
793
|
+
);
|
|
794
|
+
|
|
795
|
+
CREATE TABLE public.execution_runs (
|
|
796
|
+
id text NOT NULL,
|
|
797
|
+
type text NOT NULL,
|
|
798
|
+
"rolloutStrategy" text DEFAULT 'all_at_once'::text NOT NULL,
|
|
799
|
+
status text DEFAULT 'created'::text NOT NULL,
|
|
800
|
+
"totalNodes" integer DEFAULT 0 NOT NULL,
|
|
801
|
+
"completedNodes" integer DEFAULT 0 NOT NULL,
|
|
802
|
+
"failedNodes" integer DEFAULT 0 NOT NULL,
|
|
803
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
804
|
+
"createdBy" text NOT NULL,
|
|
805
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
806
|
+
"startedAt" timestamp(3) without time zone,
|
|
807
|
+
"completedAt" timestamp(3) without time zone
|
|
808
|
+
);
|
|
809
|
+
|
|
810
|
+
CREATE TABLE public.file_patch_tasks (
|
|
811
|
+
id text NOT NULL,
|
|
812
|
+
"nodeId" text NOT NULL,
|
|
813
|
+
"filePath" text NOT NULL,
|
|
814
|
+
direction text DEFAULT 'push'::text NOT NULL,
|
|
815
|
+
content text,
|
|
816
|
+
checksum text,
|
|
817
|
+
"previousChecksum" text,
|
|
818
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
819
|
+
error text,
|
|
820
|
+
"createdBy" text NOT NULL,
|
|
821
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
822
|
+
"completedAt" timestamp(3) without time zone
|
|
823
|
+
);
|
|
824
|
+
|
|
825
|
+
CREATE TABLE public.gpu_snapshots (
|
|
826
|
+
id text NOT NULL,
|
|
827
|
+
"nodeId" text NOT NULL,
|
|
828
|
+
"sampledAt" timestamp(3) without time zone NOT NULL,
|
|
829
|
+
"sampleIntervalSeconds" integer DEFAULT 30 NOT NULL,
|
|
830
|
+
status text DEFAULT 'unavailable'::text NOT NULL,
|
|
831
|
+
devices text NOT NULL,
|
|
832
|
+
"maxUtilizationPercent" double precision,
|
|
833
|
+
"maxFanPercent" double precision
|
|
834
|
+
);
|
|
835
|
+
|
|
836
|
+
CREATE TABLE public.health_snapshots (
|
|
837
|
+
id text NOT NULL,
|
|
838
|
+
"nodeId" text NOT NULL,
|
|
839
|
+
"timestamp" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
840
|
+
"cpuUsagePercent" double precision NOT NULL,
|
|
841
|
+
"cpuCores" integer NOT NULL,
|
|
842
|
+
"cpuLoadAverage" text NOT NULL,
|
|
843
|
+
"memoryTotalBytes" bigint NOT NULL,
|
|
844
|
+
"memoryUsedBytes" bigint NOT NULL,
|
|
845
|
+
"memoryPercent" double precision NOT NULL,
|
|
846
|
+
"swapTotalBytes" bigint NOT NULL,
|
|
847
|
+
"swapUsedBytes" bigint NOT NULL,
|
|
848
|
+
disks text NOT NULL,
|
|
849
|
+
network text NOT NULL,
|
|
850
|
+
services text NOT NULL,
|
|
851
|
+
wazuh text DEFAULT '{}'::text NOT NULL,
|
|
852
|
+
"systemUpdates" text DEFAULT '{}'::text NOT NULL,
|
|
853
|
+
"cockpitAvailable" boolean DEFAULT false NOT NULL,
|
|
854
|
+
source text DEFAULT 'system-probe'::text NOT NULL
|
|
855
|
+
);
|
|
856
|
+
|
|
857
|
+
CREATE TABLE public.hermes_core_rollout_hosts (
|
|
858
|
+
id text NOT NULL,
|
|
859
|
+
"rolloutId" text NOT NULL,
|
|
860
|
+
hostname text NOT NULL,
|
|
861
|
+
"installationId" text NOT NULL,
|
|
862
|
+
stage integer NOT NULL,
|
|
863
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
864
|
+
"leaseExpiresAt" timestamp(3) without time zone,
|
|
865
|
+
"evidenceJson" text DEFAULT '{}'::text NOT NULL,
|
|
866
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
867
|
+
);
|
|
868
|
+
|
|
869
|
+
CREATE TABLE public.hermes_core_rollouts (
|
|
870
|
+
id text NOT NULL,
|
|
871
|
+
tag text NOT NULL,
|
|
872
|
+
"bootstrapScriptSha256" text NOT NULL,
|
|
873
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
874
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
875
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
876
|
+
);
|
|
877
|
+
|
|
878
|
+
CREATE TABLE public.hermes_credential_pool_attachments (
|
|
879
|
+
id text NOT NULL,
|
|
880
|
+
"poolId" text NOT NULL,
|
|
881
|
+
"installationId" text NOT NULL,
|
|
882
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
883
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
884
|
+
"lastSyncedAt" timestamp(3) without time zone,
|
|
885
|
+
"createdBy" text NOT NULL,
|
|
886
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
887
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
888
|
+
);
|
|
889
|
+
|
|
890
|
+
CREATE TABLE public.hermes_credential_pools (
|
|
891
|
+
id text NOT NULL,
|
|
892
|
+
name text NOT NULL,
|
|
893
|
+
provider text NOT NULL,
|
|
894
|
+
"rotationPolicy" text DEFAULT 'rate-limit'::text NOT NULL,
|
|
895
|
+
"secretRefsJson" text DEFAULT '[]'::text NOT NULL,
|
|
896
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
897
|
+
"createdBy" text NOT NULL,
|
|
898
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
899
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
900
|
+
);
|
|
901
|
+
|
|
902
|
+
CREATE TABLE public.hermes_cron_jobs (
|
|
903
|
+
id text NOT NULL,
|
|
904
|
+
"installationId" text NOT NULL,
|
|
905
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
906
|
+
name text NOT NULL,
|
|
907
|
+
prompt text DEFAULT ''::text NOT NULL,
|
|
908
|
+
"cronExpr" text DEFAULT ''::text NOT NULL,
|
|
909
|
+
"naturalLanguage" text,
|
|
910
|
+
"attachedSkillsJson" text DEFAULT '[]'::text NOT NULL,
|
|
911
|
+
"deliveryJson" text DEFAULT '{}'::text NOT NULL,
|
|
912
|
+
enabled boolean DEFAULT true NOT NULL,
|
|
913
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
914
|
+
"lastRunAt" timestamp(3) without time zone,
|
|
915
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
916
|
+
"createdBy" text NOT NULL,
|
|
917
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
918
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
919
|
+
);
|
|
920
|
+
|
|
921
|
+
CREATE TABLE public.hermes_hooks (
|
|
922
|
+
id text NOT NULL,
|
|
923
|
+
"installationId" text NOT NULL,
|
|
924
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
925
|
+
event text NOT NULL,
|
|
926
|
+
target text NOT NULL,
|
|
927
|
+
"configJson" text DEFAULT '{}'::text NOT NULL,
|
|
928
|
+
enabled boolean DEFAULT true NOT NULL,
|
|
929
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
930
|
+
"lastSyncedAt" timestamp(3) without time zone,
|
|
931
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
932
|
+
"createdBy" text NOT NULL,
|
|
933
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
934
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
935
|
+
);
|
|
936
|
+
|
|
937
|
+
CREATE TABLE public.hermes_installations (
|
|
938
|
+
id text NOT NULL,
|
|
939
|
+
"nodeId" text,
|
|
940
|
+
hostname text NOT NULL,
|
|
941
|
+
"sshPort" integer DEFAULT 22 NOT NULL,
|
|
942
|
+
"displayName" text,
|
|
943
|
+
"installMode" text DEFAULT 'unknown'::text NOT NULL,
|
|
944
|
+
"hermesHome" text DEFAULT '~/.hermes'::text NOT NULL,
|
|
945
|
+
"hermesBin" text DEFAULT 'hermes'::text NOT NULL,
|
|
946
|
+
version text,
|
|
947
|
+
status text DEFAULT 'unknown'::text NOT NULL,
|
|
948
|
+
"gatewayStatus" text DEFAULT 'unknown'::text NOT NULL,
|
|
949
|
+
"dashboardHost" text DEFAULT '127.0.0.1'::text NOT NULL,
|
|
950
|
+
"dashboardPort" integer DEFAULT 9119 NOT NULL,
|
|
951
|
+
"dashboardStatus" text DEFAULT 'unknown'::text NOT NULL,
|
|
952
|
+
"apiServerEnabled" boolean DEFAULT false NOT NULL,
|
|
953
|
+
"apiServerHost" text DEFAULT '127.0.0.1'::text NOT NULL,
|
|
954
|
+
"apiServerPort" integer,
|
|
955
|
+
"lastDetectedAt" timestamp(3) without time zone,
|
|
956
|
+
"lastSyncedAt" timestamp(3) without time zone,
|
|
957
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
958
|
+
"rawStatus" text DEFAULT '{}'::text NOT NULL,
|
|
959
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
960
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
961
|
+
);
|
|
962
|
+
|
|
963
|
+
CREATE TABLE public.hermes_mcp_server_attachments (
|
|
964
|
+
id text NOT NULL,
|
|
965
|
+
"serverId" text NOT NULL,
|
|
966
|
+
"installationId" text NOT NULL,
|
|
967
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
968
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
969
|
+
"lastSyncedAt" timestamp(3) without time zone,
|
|
970
|
+
"createdBy" text NOT NULL,
|
|
971
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
972
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
973
|
+
);
|
|
974
|
+
|
|
975
|
+
CREATE TABLE public.hermes_mcp_servers (
|
|
976
|
+
id text NOT NULL,
|
|
977
|
+
name text NOT NULL,
|
|
978
|
+
transport text NOT NULL,
|
|
979
|
+
endpoint text DEFAULT ''::text NOT NULL,
|
|
980
|
+
"argsJson" text DEFAULT '[]'::text NOT NULL,
|
|
981
|
+
"envJson" text DEFAULT '{}'::text NOT NULL,
|
|
982
|
+
"toolFilterJson" text DEFAULT '[]'::text NOT NULL,
|
|
983
|
+
"samplingEnabled" boolean DEFAULT false NOT NULL,
|
|
984
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
985
|
+
"createdBy" text NOT NULL,
|
|
986
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
987
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
988
|
+
);
|
|
989
|
+
|
|
990
|
+
CREATE TABLE public.hermes_messaging_bindings (
|
|
991
|
+
id text NOT NULL,
|
|
992
|
+
"installationId" text NOT NULL,
|
|
993
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
994
|
+
platform text NOT NULL,
|
|
995
|
+
"channelIdsJson" text DEFAULT '[]'::text NOT NULL,
|
|
996
|
+
"voiceEnabled" boolean DEFAULT false NOT NULL,
|
|
997
|
+
"voiceModel" text,
|
|
998
|
+
"ttsProvider" text,
|
|
999
|
+
"secretRef" text,
|
|
1000
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1001
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1002
|
+
"lastSyncedAt" timestamp(3) without time zone,
|
|
1003
|
+
"createdBy" text NOT NULL,
|
|
1004
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1005
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1006
|
+
);
|
|
1007
|
+
|
|
1008
|
+
CREATE TABLE public.hermes_operation_jobs (
|
|
1009
|
+
id text NOT NULL,
|
|
1010
|
+
type text NOT NULL,
|
|
1011
|
+
status text DEFAULT 'queued'::text NOT NULL,
|
|
1012
|
+
"installationId" text,
|
|
1013
|
+
"profileId" text,
|
|
1014
|
+
"targetHost" text,
|
|
1015
|
+
"createdBy" text NOT NULL,
|
|
1016
|
+
steps text DEFAULT '[]'::text NOT NULL,
|
|
1017
|
+
result text,
|
|
1018
|
+
error text,
|
|
1019
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1020
|
+
"startedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1021
|
+
"completedAt" timestamp(3) without time zone
|
|
1022
|
+
);
|
|
1023
|
+
|
|
1024
|
+
CREATE TABLE public.hermes_plugin_installs (
|
|
1025
|
+
id text NOT NULL,
|
|
1026
|
+
"installationId" text NOT NULL,
|
|
1027
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
1028
|
+
"pluginSlug" text NOT NULL,
|
|
1029
|
+
"pluginType" text DEFAULT 'general'::text NOT NULL,
|
|
1030
|
+
"pinnedVersion" text,
|
|
1031
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1032
|
+
"healthState" text DEFAULT 'unknown'::text NOT NULL,
|
|
1033
|
+
"lastSyncedAt" timestamp(3) without time zone,
|
|
1034
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1035
|
+
"createdBy" text NOT NULL,
|
|
1036
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1037
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1038
|
+
);
|
|
1039
|
+
|
|
1040
|
+
CREATE TABLE public.hermes_profiles (
|
|
1041
|
+
id text NOT NULL,
|
|
1042
|
+
"installationId" text NOT NULL,
|
|
1043
|
+
name text NOT NULL,
|
|
1044
|
+
description text DEFAULT ''::text NOT NULL,
|
|
1045
|
+
"profileHome" text DEFAULT ''::text NOT NULL,
|
|
1046
|
+
"isDefault" boolean DEFAULT false NOT NULL,
|
|
1047
|
+
"providerSummary" text,
|
|
1048
|
+
"modelSummary" text,
|
|
1049
|
+
distribution text,
|
|
1050
|
+
"gatewayStatus" text DEFAULT 'unknown'::text NOT NULL,
|
|
1051
|
+
"apiServerEnabled" boolean DEFAULT false NOT NULL,
|
|
1052
|
+
"apiServerHost" text DEFAULT '127.0.0.1'::text NOT NULL,
|
|
1053
|
+
"apiServerPort" integer,
|
|
1054
|
+
"apiServerKeyFingerprint" text,
|
|
1055
|
+
capabilities text DEFAULT '{}'::text NOT NULL,
|
|
1056
|
+
"envStatus" text DEFAULT '{}'::text NOT NULL,
|
|
1057
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1058
|
+
"lastSyncedAt" timestamp(3) without time zone,
|
|
1059
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1060
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1061
|
+
);
|
|
1062
|
+
|
|
1063
|
+
CREATE TABLE public.hermes_provider_configs (
|
|
1064
|
+
id text NOT NULL,
|
|
1065
|
+
"installationId" text NOT NULL,
|
|
1066
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
1067
|
+
"chainJson" text DEFAULT '[]'::text NOT NULL,
|
|
1068
|
+
"sortStrategy" text DEFAULT 'priority'::text NOT NULL,
|
|
1069
|
+
"whitelistJson" text DEFAULT '[]'::text NOT NULL,
|
|
1070
|
+
"blacklistJson" text DEFAULT '[]'::text NOT NULL,
|
|
1071
|
+
"visionOverride" text,
|
|
1072
|
+
"compressionOverride" text,
|
|
1073
|
+
"lastSyncedAt" timestamp(3) without time zone,
|
|
1074
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1075
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1076
|
+
"createdBy" text NOT NULL,
|
|
1077
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1078
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1079
|
+
);
|
|
1080
|
+
|
|
1081
|
+
CREATE TABLE public.hermes_registry_clients (
|
|
1082
|
+
id text NOT NULL,
|
|
1083
|
+
"nodeId" text NOT NULL,
|
|
1084
|
+
"installationId" text NOT NULL,
|
|
1085
|
+
"tokenSha256" text NOT NULL,
|
|
1086
|
+
"canPull" boolean DEFAULT false NOT NULL,
|
|
1087
|
+
"canSubmit" boolean DEFAULT false NOT NULL,
|
|
1088
|
+
enabled boolean DEFAULT true NOT NULL,
|
|
1089
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1090
|
+
"revokedAt" timestamp(3) without time zone
|
|
1091
|
+
);
|
|
1092
|
+
|
|
1093
|
+
CREATE TABLE public.hermes_registry_inventory (
|
|
1094
|
+
id text NOT NULL,
|
|
1095
|
+
"installationId" text NOT NULL,
|
|
1096
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
1097
|
+
kind text NOT NULL,
|
|
1098
|
+
slug text NOT NULL,
|
|
1099
|
+
"pluginType" text,
|
|
1100
|
+
"sourceKind" text DEFAULT 'unknown'::text NOT NULL,
|
|
1101
|
+
"sourceUrl" text,
|
|
1102
|
+
commit text,
|
|
1103
|
+
version text,
|
|
1104
|
+
status text DEFAULT 'observed'::text NOT NULL,
|
|
1105
|
+
"observedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1106
|
+
);
|
|
1107
|
+
|
|
1108
|
+
CREATE TABLE public.hermes_registry_receipts (
|
|
1109
|
+
id text NOT NULL,
|
|
1110
|
+
"nodeId" text NOT NULL,
|
|
1111
|
+
"installationId" text NOT NULL,
|
|
1112
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
1113
|
+
kind text NOT NULL,
|
|
1114
|
+
slug text NOT NULL,
|
|
1115
|
+
revision integer NOT NULL,
|
|
1116
|
+
sha256 text NOT NULL,
|
|
1117
|
+
status text NOT NULL,
|
|
1118
|
+
"detailsJson" text DEFAULT '{}'::text NOT NULL,
|
|
1119
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1120
|
+
);
|
|
1121
|
+
|
|
1122
|
+
CREATE TABLE public.hermes_registry_revisions (
|
|
1123
|
+
id text NOT NULL,
|
|
1124
|
+
kind text NOT NULL,
|
|
1125
|
+
slug text NOT NULL,
|
|
1126
|
+
revision integer NOT NULL,
|
|
1127
|
+
sha256 text NOT NULL,
|
|
1128
|
+
"artifactJson" text NOT NULL,
|
|
1129
|
+
"metadataJson" text DEFAULT '{}'::text NOT NULL,
|
|
1130
|
+
status text DEFAULT 'published'::text NOT NULL,
|
|
1131
|
+
"sourceHost" text,
|
|
1132
|
+
"publishedBy" text NOT NULL,
|
|
1133
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1134
|
+
);
|
|
1135
|
+
|
|
1136
|
+
CREATE TABLE public.hermes_registry_targets (
|
|
1137
|
+
id text NOT NULL,
|
|
1138
|
+
kind text NOT NULL,
|
|
1139
|
+
slug text NOT NULL,
|
|
1140
|
+
"installationId" text NOT NULL,
|
|
1141
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
1142
|
+
"pinnedRevision" integer,
|
|
1143
|
+
enabled boolean DEFAULT true NOT NULL,
|
|
1144
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1145
|
+
"observedRevision" integer,
|
|
1146
|
+
"lastReceiptAt" timestamp(3) without time zone,
|
|
1147
|
+
error text,
|
|
1148
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1149
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1150
|
+
);
|
|
1151
|
+
|
|
1152
|
+
CREATE TABLE public.hermes_role_applications (
|
|
1153
|
+
id text NOT NULL,
|
|
1154
|
+
"roleId" text NOT NULL,
|
|
1155
|
+
"installationId" text NOT NULL,
|
|
1156
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
1157
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1158
|
+
"appliedAt" timestamp(3) without time zone,
|
|
1159
|
+
error text,
|
|
1160
|
+
"createdBy" text NOT NULL,
|
|
1161
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1162
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1163
|
+
);
|
|
1164
|
+
|
|
1165
|
+
CREATE TABLE public.hermes_roles (
|
|
1166
|
+
id text NOT NULL,
|
|
1167
|
+
name text NOT NULL,
|
|
1168
|
+
description text DEFAULT ''::text NOT NULL,
|
|
1169
|
+
"personalityMd" text DEFAULT ''::text NOT NULL,
|
|
1170
|
+
"personalityRef" text,
|
|
1171
|
+
"toolsetsJson" text DEFAULT '[]'::text NOT NULL,
|
|
1172
|
+
"skillsJson" text DEFAULT '[]'::text NOT NULL,
|
|
1173
|
+
"providerJson" text DEFAULT '{}'::text NOT NULL,
|
|
1174
|
+
"cronJson" text DEFAULT '[]'::text NOT NULL,
|
|
1175
|
+
"messagingJson" text DEFAULT '[]'::text NOT NULL,
|
|
1176
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1177
|
+
"createdBy" text NOT NULL,
|
|
1178
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1179
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1180
|
+
);
|
|
1181
|
+
|
|
1182
|
+
CREATE TABLE public.hermes_skill_assignments (
|
|
1183
|
+
id text NOT NULL,
|
|
1184
|
+
"installationId" text NOT NULL,
|
|
1185
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
1186
|
+
"skillSlug" text NOT NULL,
|
|
1187
|
+
"pinnedVersion" text,
|
|
1188
|
+
source text DEFAULT 'magnus-skills'::text NOT NULL,
|
|
1189
|
+
enabled boolean DEFAULT true NOT NULL,
|
|
1190
|
+
"lastSyncedAt" timestamp(3) without time zone,
|
|
1191
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1192
|
+
error text,
|
|
1193
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1194
|
+
"createdBy" text NOT NULL,
|
|
1195
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1196
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1197
|
+
);
|
|
1198
|
+
|
|
1199
|
+
CREATE TABLE public.hermes_toolset_policies (
|
|
1200
|
+
id text NOT NULL,
|
|
1201
|
+
"installationId" text NOT NULL,
|
|
1202
|
+
"profileId" text DEFAULT ''::text NOT NULL,
|
|
1203
|
+
toolset text NOT NULL,
|
|
1204
|
+
enabled boolean DEFAULT true NOT NULL,
|
|
1205
|
+
"approvalMode" text DEFAULT 'auto'::text NOT NULL,
|
|
1206
|
+
"perToolHooks" text DEFAULT '[]'::text NOT NULL,
|
|
1207
|
+
"allowList" text DEFAULT '[]'::text NOT NULL,
|
|
1208
|
+
"denyList" text DEFAULT '[]'::text NOT NULL,
|
|
1209
|
+
"lastSyncedAt" timestamp(3) without time zone,
|
|
1210
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1211
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1212
|
+
"createdBy" text NOT NULL,
|
|
1213
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1214
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1215
|
+
);
|
|
1216
|
+
|
|
1217
|
+
CREATE TABLE public.incident_lessons (
|
|
1218
|
+
id text NOT NULL,
|
|
1219
|
+
"incidentId" text NOT NULL,
|
|
1220
|
+
"nodeId" text,
|
|
1221
|
+
symptom text NOT NULL,
|
|
1222
|
+
cause text NOT NULL,
|
|
1223
|
+
"runbookVersion" text NOT NULL,
|
|
1224
|
+
"evidenceIds" text NOT NULL,
|
|
1225
|
+
"reviewedBy" text NOT NULL,
|
|
1226
|
+
"expiresAt" timestamp(3) without time zone NOT NULL,
|
|
1227
|
+
"supersededAt" timestamp(3) without time zone,
|
|
1228
|
+
"memoryId" text,
|
|
1229
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1230
|
+
);
|
|
1231
|
+
|
|
1232
|
+
CREATE TABLE public.library_categories (
|
|
1233
|
+
id text NOT NULL,
|
|
1234
|
+
name text NOT NULL,
|
|
1235
|
+
description text DEFAULT ''::text NOT NULL,
|
|
1236
|
+
color text DEFAULT '#6366f1'::text NOT NULL,
|
|
1237
|
+
"sortOrder" integer DEFAULT 0 NOT NULL,
|
|
1238
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1239
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1240
|
+
);
|
|
1241
|
+
|
|
1242
|
+
CREATE TABLE public.library_files (
|
|
1243
|
+
id text NOT NULL,
|
|
1244
|
+
name text NOT NULL,
|
|
1245
|
+
"fileName" text NOT NULL,
|
|
1246
|
+
"mimeType" text DEFAULT 'text/markdown'::text NOT NULL,
|
|
1247
|
+
content text DEFAULT ''::text NOT NULL,
|
|
1248
|
+
"sizeBytes" integer DEFAULT 0 NOT NULL,
|
|
1249
|
+
"categoryId" text,
|
|
1250
|
+
tags text DEFAULT '[]'::text NOT NULL,
|
|
1251
|
+
"createdBy" text NOT NULL,
|
|
1252
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1253
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1254
|
+
);
|
|
1255
|
+
|
|
1256
|
+
CREATE TABLE public.log_entries (
|
|
1257
|
+
id text NOT NULL,
|
|
1258
|
+
"nodeId" text NOT NULL,
|
|
1259
|
+
source text NOT NULL,
|
|
1260
|
+
level text NOT NULL,
|
|
1261
|
+
message text NOT NULL,
|
|
1262
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1263
|
+
"timestamp" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1264
|
+
);
|
|
1265
|
+
|
|
1266
|
+
CREATE TABLE public.magnus_release_canaries (
|
|
1267
|
+
epoch bigint NOT NULL,
|
|
1268
|
+
"tokenSha256" character varying(64) NOT NULL,
|
|
1269
|
+
"acceptedCommit" character varying(40) NOT NULL,
|
|
1270
|
+
"sourceTreeSha256" character varying(64) NOT NULL,
|
|
1271
|
+
"createdAt" timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1272
|
+
CONSTRAINT magnus_release_canaries_commit_check CHECK ((("acceptedCommit")::text ~ '^[0-9a-f]{40}$'::text)),
|
|
1273
|
+
CONSTRAINT magnus_release_canaries_epoch_check CHECK ((epoch > 0)),
|
|
1274
|
+
CONSTRAINT magnus_release_canaries_source_check CHECK ((("sourceTreeSha256")::text ~ '^[0-9a-f]{64}$'::text)),
|
|
1275
|
+
CONSTRAINT magnus_release_canaries_token_check CHECK ((("tokenSha256")::text ~ '^[0-9a-f]{64}$'::text))
|
|
1276
|
+
);
|
|
1277
|
+
|
|
1278
|
+
COMMENT ON TABLE public.magnus_release_canaries IS 'Append-only database side of the root-owned Magnus release anti-rewind chain';
|
|
1279
|
+
|
|
1280
|
+
CREATE TABLE public.maintenance_windows (
|
|
1281
|
+
id text NOT NULL,
|
|
1282
|
+
reason text NOT NULL,
|
|
1283
|
+
"nodeIds" text NOT NULL,
|
|
1284
|
+
"serviceIds" text DEFAULT '[]'::text NOT NULL,
|
|
1285
|
+
"actorId" text NOT NULL,
|
|
1286
|
+
"startsAt" timestamp(3) without time zone NOT NULL,
|
|
1287
|
+
"endsAt" timestamp(3) without time zone NOT NULL,
|
|
1288
|
+
"cancelledAt" timestamp(3) without time zone,
|
|
1289
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1290
|
+
);
|
|
1291
|
+
|
|
1292
|
+
CREATE TABLE public.managed_cron_definitions (
|
|
1293
|
+
"cronJobId" text NOT NULL,
|
|
1294
|
+
"nodeId" text NOT NULL,
|
|
1295
|
+
"jobId" text NOT NULL,
|
|
1296
|
+
revision integer NOT NULL,
|
|
1297
|
+
"specSha256" text NOT NULL,
|
|
1298
|
+
"specJson" text NOT NULL,
|
|
1299
|
+
enabled boolean DEFAULT false NOT NULL,
|
|
1300
|
+
"expiresAt" timestamp(3) without time zone NOT NULL,
|
|
1301
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1302
|
+
"acknowledgementProtocolVersion" integer,
|
|
1303
|
+
"stageCommandSha256" text,
|
|
1304
|
+
"stageReceiptSha256" text,
|
|
1305
|
+
"stageAcknowledgedAt" timestamp(3) without time zone,
|
|
1306
|
+
"activationCommandSha256" text,
|
|
1307
|
+
"activationReceiptSha256" text,
|
|
1308
|
+
"activationAcknowledgedAt" timestamp(3) without time zone,
|
|
1309
|
+
"acknowledgedJobId" text,
|
|
1310
|
+
"acknowledgedRevision" integer,
|
|
1311
|
+
"acknowledgedSpecSha256" text,
|
|
1312
|
+
"acknowledgedSpecJson" text,
|
|
1313
|
+
CONSTRAINT managed_cron_definitions_revision_check CHECK ((revision > 0)),
|
|
1314
|
+
CONSTRAINT managed_cron_enabled_requires_v1_acknowledgement CHECK (((enabled = false) OR (("acknowledgementProtocolVersion" IS NOT NULL) AND ("acknowledgementProtocolVersion" = 1) AND ("stageCommandSha256" IS NOT NULL) AND ("stageReceiptSha256" IS NOT NULL) AND ("stageAcknowledgedAt" IS NOT NULL) AND ("activationCommandSha256" IS NOT NULL) AND ("activationReceiptSha256" IS NOT NULL) AND ("activationAcknowledgedAt" IS NOT NULL) AND ("acknowledgedJobId" IS NOT NULL) AND ("acknowledgedRevision" IS NOT NULL) AND ("acknowledgedSpecSha256" IS NOT NULL) AND ("acknowledgedSpecJson" IS NOT NULL) AND ("jobId" = "acknowledgedJobId") AND (revision = "acknowledgedRevision") AND ("specSha256" = "acknowledgedSpecSha256") AND ("specJson" = "acknowledgedSpecJson"))))
|
|
1315
|
+
);
|
|
1316
|
+
|
|
1317
|
+
CREATE TABLE public.managed_cron_occurrences (
|
|
1318
|
+
id text NOT NULL,
|
|
1319
|
+
"cronJobId" text NOT NULL,
|
|
1320
|
+
"nodeId" text NOT NULL,
|
|
1321
|
+
revision integer NOT NULL,
|
|
1322
|
+
"specSha256" text NOT NULL,
|
|
1323
|
+
"scheduledAt" timestamp(3) without time zone NOT NULL,
|
|
1324
|
+
deadline timestamp(3) without time zone NOT NULL,
|
|
1325
|
+
"commandId" text NOT NULL,
|
|
1326
|
+
state text DEFAULT 'admitting'::text NOT NULL,
|
|
1327
|
+
"admissionJson" text,
|
|
1328
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1329
|
+
CONSTRAINT managed_cron_occurrences_revision_check CHECK ((revision > 0))
|
|
1330
|
+
);
|
|
1331
|
+
|
|
1332
|
+
CREATE TABLE public.nodes (
|
|
1333
|
+
id text NOT NULL,
|
|
1334
|
+
name text NOT NULL,
|
|
1335
|
+
hostname text NOT NULL,
|
|
1336
|
+
"ipAddress" text NOT NULL,
|
|
1337
|
+
port integer DEFAULT 4100 NOT NULL,
|
|
1338
|
+
status public."NodeStatus" DEFAULT 'PROVISIONING'::public."NodeStatus" NOT NULL,
|
|
1339
|
+
os text NOT NULL,
|
|
1340
|
+
arch text NOT NULL,
|
|
1341
|
+
tags text DEFAULT '[]'::text NOT NULL,
|
|
1342
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1343
|
+
token text NOT NULL,
|
|
1344
|
+
"roleId" text,
|
|
1345
|
+
"lastHeartbeatAt" timestamp(3) without time zone,
|
|
1346
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1347
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1348
|
+
);
|
|
1349
|
+
|
|
1350
|
+
CREATE TABLE public.notification_preferences (
|
|
1351
|
+
id text NOT NULL,
|
|
1352
|
+
"userId" text NOT NULL,
|
|
1353
|
+
channel text DEFAULT 'in_app'::text NOT NULL,
|
|
1354
|
+
category text NOT NULL,
|
|
1355
|
+
enabled boolean DEFAULT true NOT NULL,
|
|
1356
|
+
"minSeverity" text DEFAULT 'info'::text NOT NULL,
|
|
1357
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1358
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1359
|
+
);
|
|
1360
|
+
|
|
1361
|
+
CREATE TABLE public.notifications (
|
|
1362
|
+
id text NOT NULL,
|
|
1363
|
+
type text NOT NULL,
|
|
1364
|
+
severity text DEFAULT 'warning'::text NOT NULL,
|
|
1365
|
+
title text NOT NULL,
|
|
1366
|
+
message text NOT NULL,
|
|
1367
|
+
"nodeId" text,
|
|
1368
|
+
"nodeName" text,
|
|
1369
|
+
"sourceRef" text,
|
|
1370
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1371
|
+
"isRead" boolean DEFAULT false NOT NULL,
|
|
1372
|
+
"readAt" timestamp(3) without time zone,
|
|
1373
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1374
|
+
"suppressedBy" text
|
|
1375
|
+
);
|
|
1376
|
+
|
|
1377
|
+
CREATE TABLE public.remediation_executions (
|
|
1378
|
+
id text NOT NULL,
|
|
1379
|
+
"ruleId" text NOT NULL,
|
|
1380
|
+
"anomalyEventId" text NOT NULL,
|
|
1381
|
+
"nodeId" text NOT NULL,
|
|
1382
|
+
"orchestraRunId" text,
|
|
1383
|
+
status text DEFAULT 'triggered'::text NOT NULL,
|
|
1384
|
+
input text DEFAULT ''::text NOT NULL,
|
|
1385
|
+
output text,
|
|
1386
|
+
"triggeredAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1387
|
+
"completedAt" timestamp(3) without time zone
|
|
1388
|
+
);
|
|
1389
|
+
|
|
1390
|
+
CREATE TABLE public.remediation_rules (
|
|
1391
|
+
id text NOT NULL,
|
|
1392
|
+
name text NOT NULL,
|
|
1393
|
+
description text DEFAULT ''::text NOT NULL,
|
|
1394
|
+
metric text DEFAULT '*'::text NOT NULL,
|
|
1395
|
+
"severityThreshold" text DEFAULT 'critical'::text NOT NULL,
|
|
1396
|
+
"agentDefinitionId" text NOT NULL,
|
|
1397
|
+
input text DEFAULT ''::text NOT NULL,
|
|
1398
|
+
"cooldownMinutes" integer DEFAULT 60 NOT NULL,
|
|
1399
|
+
"maxConcurrentRuns" integer DEFAULT 1 NOT NULL,
|
|
1400
|
+
"nodeFilter" text,
|
|
1401
|
+
enabled boolean DEFAULT true NOT NULL,
|
|
1402
|
+
"createdBy" text DEFAULT 'system'::text NOT NULL,
|
|
1403
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1404
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1405
|
+
);
|
|
1406
|
+
|
|
1407
|
+
CREATE TABLE public.remote_commands (
|
|
1408
|
+
id text NOT NULL,
|
|
1409
|
+
"nodeId" text NOT NULL,
|
|
1410
|
+
command text NOT NULL,
|
|
1411
|
+
args text DEFAULT '[]'::text NOT NULL,
|
|
1412
|
+
"workingDirectory" text,
|
|
1413
|
+
environment text DEFAULT '{}'::text NOT NULL,
|
|
1414
|
+
"timeoutSeconds" integer DEFAULT 300 NOT NULL,
|
|
1415
|
+
status public."CommandStatus" DEFAULT 'PENDING'::public."CommandStatus" NOT NULL,
|
|
1416
|
+
"riskLevel" text DEFAULT 'low'::text NOT NULL,
|
|
1417
|
+
"idempotencyKey" text NOT NULL,
|
|
1418
|
+
"correlationId" text,
|
|
1419
|
+
"createdBy" text NOT NULL,
|
|
1420
|
+
"approvedBy" text,
|
|
1421
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1422
|
+
"startedAt" timestamp(3) without time zone,
|
|
1423
|
+
"completedAt" timestamp(3) without time zone,
|
|
1424
|
+
"executionDeadline" timestamp(3) without time zone,
|
|
1425
|
+
"coordinationJson" text
|
|
1426
|
+
);
|
|
1427
|
+
|
|
1428
|
+
CREATE TABLE public.resource_drain_participants (
|
|
1429
|
+
"nodeId" text NOT NULL,
|
|
1430
|
+
participant text NOT NULL,
|
|
1431
|
+
epoch integer NOT NULL,
|
|
1432
|
+
"barrierId" text NOT NULL,
|
|
1433
|
+
"challengeId" text NOT NULL,
|
|
1434
|
+
"challengeExpiresAt" timestamp(3) without time zone NOT NULL,
|
|
1435
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1436
|
+
"evidenceSha256" text,
|
|
1437
|
+
"receiptJson" text,
|
|
1438
|
+
"verifiedAt" timestamp(3) without time zone,
|
|
1439
|
+
CONSTRAINT resource_drain_participants_participant_check CHECK ((participant = ANY (ARRAY['agent'::text, 'api'::text, 'dashboard'::text, 'scheduler'::text])))
|
|
1440
|
+
);
|
|
1441
|
+
|
|
1442
|
+
CREATE TABLE public.resource_enrollments (
|
|
1443
|
+
"nodeId" text NOT NULL,
|
|
1444
|
+
"nodeFqdn" text NOT NULL,
|
|
1445
|
+
state text DEFAULT 'legacy'::text NOT NULL,
|
|
1446
|
+
epoch integer DEFAULT 0 NOT NULL,
|
|
1447
|
+
"barrierId" text,
|
|
1448
|
+
"startedBy" text,
|
|
1449
|
+
"startedAt" timestamp(3) without time zone,
|
|
1450
|
+
"enrolledAt" timestamp(3) without time zone,
|
|
1451
|
+
"updatedAt" timestamp(3) without time zone NOT NULL,
|
|
1452
|
+
CONSTRAINT resource_enrollments_epoch_check CHECK ((epoch >= 0)),
|
|
1453
|
+
CONSTRAINT resource_enrollments_state_check CHECK ((state = ANY (ARRAY['legacy'::text, 'draining'::text, 'enrolled'::text])))
|
|
1454
|
+
);
|
|
1455
|
+
|
|
1456
|
+
CREATE TABLE public.resource_participant_work (
|
|
1457
|
+
"workId" text NOT NULL,
|
|
1458
|
+
"nodeId" text NOT NULL,
|
|
1459
|
+
participant text NOT NULL,
|
|
1460
|
+
"ownerId" text NOT NULL,
|
|
1461
|
+
kind text NOT NULL,
|
|
1462
|
+
epoch integer NOT NULL,
|
|
1463
|
+
"barrierId" text,
|
|
1464
|
+
state text DEFAULT 'reserved'::text NOT NULL,
|
|
1465
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1466
|
+
"startedAt" timestamp(3) without time zone,
|
|
1467
|
+
"settledAt" timestamp(3) without time zone,
|
|
1468
|
+
settlement text,
|
|
1469
|
+
"evidenceSha256" text,
|
|
1470
|
+
"nodeFqdn" text,
|
|
1471
|
+
"requestSha256" text,
|
|
1472
|
+
"reconciliationDecisionId" text,
|
|
1473
|
+
"reconciliationJson" text,
|
|
1474
|
+
"operationSha256" text,
|
|
1475
|
+
fence bigint,
|
|
1476
|
+
deadline timestamp(3) without time zone,
|
|
1477
|
+
"nodeSessionReceiptSha256" text,
|
|
1478
|
+
"nodeSessionReceiptJson" text,
|
|
1479
|
+
CONSTRAINT resource_participant_work_authority_complete CHECK (((("operationSha256" IS NULL) AND (fence IS NULL) AND (deadline IS NULL)) OR (("operationSha256" ~ '^[a-f0-9]{64}$'::text) AND (fence > 0) AND (deadline IS NOT NULL)))),
|
|
1480
|
+
CONSTRAINT resource_participant_work_node_receipt_complete CHECK (((("nodeSessionReceiptSha256" IS NULL) AND ("nodeSessionReceiptJson" IS NULL)) OR (("nodeSessionReceiptSha256" ~ '^[a-f0-9]{64}$'::text) AND ("nodeSessionReceiptJson" IS NOT NULL)))),
|
|
1481
|
+
CONSTRAINT resource_participant_work_participant_check CHECK ((participant = ANY (ARRAY['agent'::text, 'api'::text, 'dashboard'::text, 'scheduler'::text]))),
|
|
1482
|
+
CONSTRAINT resource_participant_work_state_check CHECK ((state = ANY (ARRAY['reserved'::text, 'running'::text, 'unknown'::text, 'released'::text])))
|
|
1483
|
+
);
|
|
1484
|
+
|
|
1485
|
+
CREATE TABLE public.role_applications (
|
|
1486
|
+
id text NOT NULL,
|
|
1487
|
+
"nodeId" text NOT NULL,
|
|
1488
|
+
"roleId" text NOT NULL,
|
|
1489
|
+
action text NOT NULL,
|
|
1490
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1491
|
+
steps text DEFAULT '[]'::text NOT NULL,
|
|
1492
|
+
error text,
|
|
1493
|
+
"startedAt" timestamp(3) without time zone,
|
|
1494
|
+
"completedAt" timestamp(3) without time zone,
|
|
1495
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1496
|
+
);
|
|
1497
|
+
|
|
1498
|
+
CREATE TABLE public.roles (
|
|
1499
|
+
id text NOT NULL,
|
|
1500
|
+
name text NOT NULL,
|
|
1501
|
+
description text DEFAULT ''::text NOT NULL,
|
|
1502
|
+
"libraryFileIds" text DEFAULT '[]'::text NOT NULL,
|
|
1503
|
+
"skillNames" text DEFAULT '[]'::text NOT NULL,
|
|
1504
|
+
"aptPackages" text DEFAULT '[]'::text NOT NULL,
|
|
1505
|
+
"npmPackages" text DEFAULT '[]'::text NOT NULL,
|
|
1506
|
+
"envConfig" text DEFAULT '{}'::text NOT NULL,
|
|
1507
|
+
"dockerEnabled" boolean DEFAULT false NOT NULL,
|
|
1508
|
+
"dockerNonRoot" boolean DEFAULT false NOT NULL,
|
|
1509
|
+
"dockerImage" text,
|
|
1510
|
+
"dockerVolumes" text DEFAULT '[]'::text NOT NULL,
|
|
1511
|
+
"firewallEnabled" boolean DEFAULT false NOT NULL,
|
|
1512
|
+
"firewallMode" text DEFAULT 'restrictive'::text NOT NULL,
|
|
1513
|
+
"firewallAllowRules" text DEFAULT '[]'::text NOT NULL,
|
|
1514
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
1515
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1516
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1517
|
+
);
|
|
1518
|
+
|
|
1519
|
+
CREATE TABLE public.rollout_targets (
|
|
1520
|
+
id text NOT NULL,
|
|
1521
|
+
"rolloutId" text NOT NULL,
|
|
1522
|
+
"nodeId" text NOT NULL,
|
|
1523
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1524
|
+
error text,
|
|
1525
|
+
"startedAt" timestamp(3) without time zone,
|
|
1526
|
+
"completedAt" timestamp(3) without time zone,
|
|
1527
|
+
"commandId" text,
|
|
1528
|
+
evidence text DEFAULT '{}'::text NOT NULL
|
|
1529
|
+
);
|
|
1530
|
+
|
|
1531
|
+
CREATE TABLE public.security_export_outbox (
|
|
1532
|
+
id text NOT NULL,
|
|
1533
|
+
payload text NOT NULL,
|
|
1534
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1535
|
+
"deliveredAt" timestamp(3) without time zone,
|
|
1536
|
+
attempts integer DEFAULT 0 NOT NULL,
|
|
1537
|
+
"nextAttemptAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1538
|
+
"lastError" text
|
|
1539
|
+
);
|
|
1540
|
+
|
|
1541
|
+
CREATE TABLE public.security_fusion_action_approvals (
|
|
1542
|
+
id text NOT NULL,
|
|
1543
|
+
"actionId" text NOT NULL,
|
|
1544
|
+
"previewSha256" text NOT NULL,
|
|
1545
|
+
"tokenHash" text NOT NULL,
|
|
1546
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1547
|
+
"requestedBy" text NOT NULL,
|
|
1548
|
+
"decidedBy" text,
|
|
1549
|
+
"expiresAt" timestamp(3) without time zone NOT NULL,
|
|
1550
|
+
"decidedAt" timestamp(3) without time zone,
|
|
1551
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1552
|
+
);
|
|
1553
|
+
|
|
1554
|
+
CREATE TABLE public.security_fusion_actions (
|
|
1555
|
+
id text NOT NULL,
|
|
1556
|
+
"caseId" text NOT NULL,
|
|
1557
|
+
"nodeId" text NOT NULL,
|
|
1558
|
+
kind text NOT NULL,
|
|
1559
|
+
"serviceName" text,
|
|
1560
|
+
"isolationMinutes" integer,
|
|
1561
|
+
rationale text NOT NULL,
|
|
1562
|
+
"rollbackPlan" text NOT NULL,
|
|
1563
|
+
"previewJson" text NOT NULL,
|
|
1564
|
+
"previewSha256" text NOT NULL,
|
|
1565
|
+
status text DEFAULT 'previewed'::text NOT NULL,
|
|
1566
|
+
"requestedBy" text NOT NULL,
|
|
1567
|
+
"approvedBy" text,
|
|
1568
|
+
"approvalTokenHash" text,
|
|
1569
|
+
"approvalExpiresAt" timestamp(3) without time zone,
|
|
1570
|
+
"executedAt" timestamp(3) without time zone,
|
|
1571
|
+
"resultJson" text,
|
|
1572
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1573
|
+
"updatedAt" timestamp(3) without time zone NOT NULL,
|
|
1574
|
+
"verificationDeadline" timestamp(3) without time zone
|
|
1575
|
+
);
|
|
1576
|
+
|
|
1577
|
+
CREATE TABLE public.security_fusion_case_activity (
|
|
1578
|
+
id text NOT NULL,
|
|
1579
|
+
"caseId" text NOT NULL,
|
|
1580
|
+
kind text NOT NULL,
|
|
1581
|
+
"actorId" text NOT NULL,
|
|
1582
|
+
"detailJson" text DEFAULT '{}'::text NOT NULL,
|
|
1583
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1584
|
+
);
|
|
1585
|
+
|
|
1586
|
+
CREATE TABLE public.security_fusion_case_entities (
|
|
1587
|
+
id text NOT NULL,
|
|
1588
|
+
"caseId" text NOT NULL,
|
|
1589
|
+
"entityId" text NOT NULL
|
|
1590
|
+
);
|
|
1591
|
+
|
|
1592
|
+
CREATE TABLE public.security_fusion_case_events (
|
|
1593
|
+
id text NOT NULL,
|
|
1594
|
+
"caseId" text NOT NULL,
|
|
1595
|
+
"eventId" text NOT NULL,
|
|
1596
|
+
"ruleId" text DEFAULT 'builtin-security-fusion'::text NOT NULL,
|
|
1597
|
+
"confidenceContribution" double precision DEFAULT 0 NOT NULL
|
|
1598
|
+
);
|
|
1599
|
+
|
|
1600
|
+
CREATE TABLE public.security_fusion_case_relationships (
|
|
1601
|
+
id text NOT NULL,
|
|
1602
|
+
"fromCaseId" text NOT NULL,
|
|
1603
|
+
"toCaseId" text NOT NULL,
|
|
1604
|
+
kind text NOT NULL,
|
|
1605
|
+
confidence double precision NOT NULL,
|
|
1606
|
+
"rationaleJson" text DEFAULT '{}'::text NOT NULL,
|
|
1607
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1608
|
+
);
|
|
1609
|
+
|
|
1610
|
+
CREATE TABLE public.security_fusion_cases (
|
|
1611
|
+
id text NOT NULL,
|
|
1612
|
+
fingerprint text NOT NULL,
|
|
1613
|
+
title text NOT NULL,
|
|
1614
|
+
status text DEFAULT 'new'::text NOT NULL,
|
|
1615
|
+
severity text NOT NULL,
|
|
1616
|
+
confidence double precision NOT NULL,
|
|
1617
|
+
summary text NOT NULL,
|
|
1618
|
+
"recommendedInvestigationJson" text DEFAULT '[]'::text NOT NULL,
|
|
1619
|
+
"evidenceStepsJson" text DEFAULT '[]'::text NOT NULL,
|
|
1620
|
+
"assignedTo" text,
|
|
1621
|
+
"firstSeenAt" timestamp(3) without time zone NOT NULL,
|
|
1622
|
+
"lastSeenAt" timestamp(3) without time zone NOT NULL,
|
|
1623
|
+
"resolvedAt" timestamp(3) without time zone,
|
|
1624
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1625
|
+
"updatedAt" timestamp(3) without time zone NOT NULL,
|
|
1626
|
+
"archivedAt" timestamp(3) without time zone,
|
|
1627
|
+
"evidenceAcceptedCount" integer DEFAULT 0 NOT NULL,
|
|
1628
|
+
"evidenceTruncatedCount" integer DEFAULT 0 NOT NULL
|
|
1629
|
+
);
|
|
1630
|
+
|
|
1631
|
+
CREATE TABLE public.security_fusion_collectors (
|
|
1632
|
+
id text NOT NULL,
|
|
1633
|
+
"displayName" text NOT NULL,
|
|
1634
|
+
"credentialFingerprint" text NOT NULL,
|
|
1635
|
+
"allowedSourcesJson" text DEFAULT '[]'::text NOT NULL,
|
|
1636
|
+
"schemaVersion" text DEFAULT '1.0'::text NOT NULL,
|
|
1637
|
+
"dataClassification" text DEFAULT 'restricted'::text NOT NULL,
|
|
1638
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
1639
|
+
"lastReceiptAt" timestamp(3) without time zone,
|
|
1640
|
+
"lastSuccessAt" timestamp(3) without time zone,
|
|
1641
|
+
"lastErrorAt" timestamp(3) without time zone,
|
|
1642
|
+
"lastError" text,
|
|
1643
|
+
"revokedAt" timestamp(3) without time zone,
|
|
1644
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1645
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1646
|
+
);
|
|
1647
|
+
|
|
1648
|
+
CREATE TABLE public.security_fusion_command_outbox (
|
|
1649
|
+
id text NOT NULL,
|
|
1650
|
+
"actionId" text NOT NULL,
|
|
1651
|
+
operation text NOT NULL,
|
|
1652
|
+
"actorId" text NOT NULL,
|
|
1653
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1654
|
+
"remoteCommandId" text,
|
|
1655
|
+
attempts integer DEFAULT 0 NOT NULL,
|
|
1656
|
+
"nextAttemptAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1657
|
+
"leaseExpiresAt" timestamp(3) without time zone,
|
|
1658
|
+
"lastError" text,
|
|
1659
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1660
|
+
"updatedAt" timestamp(3) without time zone NOT NULL,
|
|
1661
|
+
"dispatchedAt" timestamp(3) without time zone
|
|
1662
|
+
);
|
|
1663
|
+
|
|
1664
|
+
CREATE TABLE public.security_fusion_deletion_receipts (
|
|
1665
|
+
id text NOT NULL,
|
|
1666
|
+
"resourceType" text NOT NULL,
|
|
1667
|
+
"resourceIdHash" text NOT NULL,
|
|
1668
|
+
reason text NOT NULL,
|
|
1669
|
+
outcome text NOT NULL,
|
|
1670
|
+
"bytesDeleted" integer DEFAULT 0 NOT NULL,
|
|
1671
|
+
"detailJson" text DEFAULT '{}'::text NOT NULL,
|
|
1672
|
+
"receiptSha256" text NOT NULL,
|
|
1673
|
+
"deletedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1674
|
+
"previousReceiptSha256" text,
|
|
1675
|
+
"chainSequence" integer NOT NULL,
|
|
1676
|
+
"chainVersion" integer DEFAULT 2 NOT NULL
|
|
1677
|
+
);
|
|
1678
|
+
|
|
1679
|
+
CREATE TABLE public.security_fusion_deliveries (
|
|
1680
|
+
id text NOT NULL,
|
|
1681
|
+
"caseId" text NOT NULL,
|
|
1682
|
+
"revisionKey" text NOT NULL,
|
|
1683
|
+
channel text NOT NULL,
|
|
1684
|
+
status text NOT NULL,
|
|
1685
|
+
"externalId" text,
|
|
1686
|
+
error text,
|
|
1687
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1688
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1689
|
+
);
|
|
1690
|
+
|
|
1691
|
+
CREATE TABLE public.security_fusion_entities (
|
|
1692
|
+
id text NOT NULL,
|
|
1693
|
+
type text NOT NULL,
|
|
1694
|
+
canonical text NOT NULL,
|
|
1695
|
+
label text NOT NULL,
|
|
1696
|
+
"aliasesJson" text DEFAULT '[]'::text NOT NULL,
|
|
1697
|
+
"firstSeenAt" timestamp(3) without time zone NOT NULL,
|
|
1698
|
+
"lastSeenAt" timestamp(3) without time zone NOT NULL,
|
|
1699
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1700
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1701
|
+
);
|
|
1702
|
+
|
|
1703
|
+
CREATE TABLE public.security_fusion_entity_aliases (
|
|
1704
|
+
id text NOT NULL,
|
|
1705
|
+
"entityId" text NOT NULL,
|
|
1706
|
+
source text NOT NULL,
|
|
1707
|
+
value text NOT NULL,
|
|
1708
|
+
canonical text NOT NULL,
|
|
1709
|
+
"firstSeenAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1710
|
+
"lastSeenAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1711
|
+
);
|
|
1712
|
+
|
|
1713
|
+
CREATE TABLE public.security_fusion_event_entities (
|
|
1714
|
+
id text NOT NULL,
|
|
1715
|
+
"eventId" text NOT NULL,
|
|
1716
|
+
"entityId" text NOT NULL
|
|
1717
|
+
);
|
|
1718
|
+
|
|
1719
|
+
CREATE TABLE public.security_fusion_events (
|
|
1720
|
+
id text NOT NULL,
|
|
1721
|
+
"eventId" text NOT NULL,
|
|
1722
|
+
source text NOT NULL,
|
|
1723
|
+
"sourceEventId" text NOT NULL,
|
|
1724
|
+
kind text NOT NULL,
|
|
1725
|
+
"observedAt" timestamp(3) without time zone NOT NULL,
|
|
1726
|
+
"ingestedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1727
|
+
severity text NOT NULL,
|
|
1728
|
+
confidence double precision NOT NULL,
|
|
1729
|
+
summary text NOT NULL,
|
|
1730
|
+
"attributesJson" text DEFAULT '{}'::text NOT NULL,
|
|
1731
|
+
"integritySha256" text NOT NULL,
|
|
1732
|
+
"collectorId" text NOT NULL
|
|
1733
|
+
);
|
|
1734
|
+
|
|
1735
|
+
CREATE TABLE public.security_fusion_evidence (
|
|
1736
|
+
id text NOT NULL,
|
|
1737
|
+
"caseId" text NOT NULL,
|
|
1738
|
+
"eventId" text,
|
|
1739
|
+
"sourceLocator" text NOT NULL,
|
|
1740
|
+
"mediaType" text NOT NULL,
|
|
1741
|
+
sha256 text NOT NULL,
|
|
1742
|
+
"storagePath" text NOT NULL,
|
|
1743
|
+
"preservedBy" text NOT NULL,
|
|
1744
|
+
"preservedAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1745
|
+
"expiresAt" timestamp(3) without time zone NOT NULL,
|
|
1746
|
+
"byteSize" integer DEFAULT 0 NOT NULL,
|
|
1747
|
+
"integrityStatus" text DEFAULT 'verified'::text NOT NULL,
|
|
1748
|
+
"quarantinedAt" timestamp(3) without time zone,
|
|
1749
|
+
"quarantineReason" text
|
|
1750
|
+
);
|
|
1751
|
+
|
|
1752
|
+
CREATE TABLE public.security_fusion_investigations (
|
|
1753
|
+
id text NOT NULL,
|
|
1754
|
+
"caseId" text NOT NULL,
|
|
1755
|
+
revision integer NOT NULL,
|
|
1756
|
+
"authorId" text NOT NULL,
|
|
1757
|
+
"draftJson" text NOT NULL,
|
|
1758
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1759
|
+
);
|
|
1760
|
+
|
|
1761
|
+
CREATE TABLE public.security_fusion_nonces (
|
|
1762
|
+
nonce text NOT NULL,
|
|
1763
|
+
"collectorId" text NOT NULL,
|
|
1764
|
+
"expiresAt" timestamp(3) without time zone NOT NULL,
|
|
1765
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1766
|
+
);
|
|
1767
|
+
|
|
1768
|
+
CREATE TABLE public.security_fusion_receipt_chain_heads (
|
|
1769
|
+
id text NOT NULL,
|
|
1770
|
+
"headSha256" text,
|
|
1771
|
+
"chainSequence" integer DEFAULT 0 NOT NULL,
|
|
1772
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1773
|
+
);
|
|
1774
|
+
|
|
1775
|
+
CREATE TABLE public.security_fusion_rule_versions (
|
|
1776
|
+
id text NOT NULL,
|
|
1777
|
+
"ruleId" text NOT NULL,
|
|
1778
|
+
version integer NOT NULL,
|
|
1779
|
+
enabled boolean DEFAULT true NOT NULL,
|
|
1780
|
+
"definitionJson" text NOT NULL,
|
|
1781
|
+
sha256 text NOT NULL,
|
|
1782
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1783
|
+
);
|
|
1784
|
+
|
|
1785
|
+
CREATE TABLE public.security_fusion_source_state (
|
|
1786
|
+
id text NOT NULL,
|
|
1787
|
+
source text NOT NULL,
|
|
1788
|
+
status text DEFAULT 'unknown'::text NOT NULL,
|
|
1789
|
+
checkpoint text,
|
|
1790
|
+
"lastEventAt" timestamp(3) without time zone,
|
|
1791
|
+
"lastSuccessAt" timestamp(3) without time zone,
|
|
1792
|
+
"lastErrorAt" timestamp(3) without time zone,
|
|
1793
|
+
"lastError" text,
|
|
1794
|
+
"rejectedCount" integer DEFAULT 0 NOT NULL,
|
|
1795
|
+
"updatedAt" timestamp(3) without time zone NOT NULL,
|
|
1796
|
+
"truncatedCount" integer DEFAULT 0 NOT NULL
|
|
1797
|
+
);
|
|
1798
|
+
|
|
1799
|
+
CREATE TABLE public.security_service_states (
|
|
1800
|
+
"nodeId" text NOT NULL,
|
|
1801
|
+
"serviceName" text NOT NULL,
|
|
1802
|
+
status text NOT NULL,
|
|
1803
|
+
"observationId" text NOT NULL,
|
|
1804
|
+
"observedAt" timestamp(3) without time zone NOT NULL
|
|
1805
|
+
);
|
|
1806
|
+
|
|
1807
|
+
CREATE TABLE public.shared_resource_fences (
|
|
1808
|
+
"resourceKey" text NOT NULL,
|
|
1809
|
+
generation bigint DEFAULT 1 NOT NULL,
|
|
1810
|
+
"updatedAt" timestamp(3) without time zone NOT NULL,
|
|
1811
|
+
CONSTRAINT shared_resource_fences_generation_check CHECK ((generation > 0)),
|
|
1812
|
+
CONSTRAINT shared_resource_fences_key_check CHECK (("resourceKey" ~ '^(repo:[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)*|provider:[a-z0-9][a-z0-9._-]*(:[a-z0-9][a-z0-9._-]*)*|gpu:[a-z0-9][a-z0-9._-]*)$'::text))
|
|
1813
|
+
);
|
|
1814
|
+
|
|
1815
|
+
CREATE TABLE public.shared_resource_lease_resources (
|
|
1816
|
+
"leaseId" text NOT NULL,
|
|
1817
|
+
"resourceKey" text NOT NULL,
|
|
1818
|
+
"fenceGeneration" bigint NOT NULL,
|
|
1819
|
+
state text DEFAULT 'reserved'::text NOT NULL,
|
|
1820
|
+
CONSTRAINT shared_resource_lease_resources_generation_check CHECK (("fenceGeneration" > 0)),
|
|
1821
|
+
CONSTRAINT shared_resource_lease_resources_key_check CHECK (("resourceKey" ~ '^(repo:[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)*|provider:[a-z0-9][a-z0-9._-]*(:[a-z0-9][a-z0-9._-]*)*|gpu:[a-z0-9][a-z0-9._-]*)$'::text)),
|
|
1822
|
+
CONSTRAINT shared_resource_lease_resources_state_check CHECK ((state = ANY (ARRAY['reserved'::text, 'running'::text, 'unknown'::text, 'released'::text])))
|
|
1823
|
+
);
|
|
1824
|
+
|
|
1825
|
+
CREATE TABLE public.shared_resource_leases (
|
|
1826
|
+
id text NOT NULL,
|
|
1827
|
+
"missionRootId" text NOT NULL,
|
|
1828
|
+
"missionRevision" integer NOT NULL,
|
|
1829
|
+
"taskId" text NOT NULL,
|
|
1830
|
+
"operationId" text NOT NULL,
|
|
1831
|
+
"requestSha256" text NOT NULL,
|
|
1832
|
+
"actionClass" text NOT NULL,
|
|
1833
|
+
"ownerActor" text NOT NULL,
|
|
1834
|
+
"callerKind" text NOT NULL,
|
|
1835
|
+
"delegationId" text,
|
|
1836
|
+
"missionIssuer" text NOT NULL,
|
|
1837
|
+
"missionKeyId" text NOT NULL,
|
|
1838
|
+
"missionAssertionSha256" text NOT NULL,
|
|
1839
|
+
"missionAssertionJson" text NOT NULL,
|
|
1840
|
+
"resourceSetBinding" text NOT NULL,
|
|
1841
|
+
state text DEFAULT 'reserved'::text NOT NULL,
|
|
1842
|
+
deadline timestamp(3) without time zone NOT NULL,
|
|
1843
|
+
"acquiredAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1844
|
+
"startedAt" timestamp(3) without time zone,
|
|
1845
|
+
"settledAt" timestamp(3) without time zone,
|
|
1846
|
+
settlement text,
|
|
1847
|
+
"evidenceSha256" text,
|
|
1848
|
+
"settlementRecordSha256" text,
|
|
1849
|
+
"terminalEvidenceJson" text,
|
|
1850
|
+
"reconciliationDecisionId" text,
|
|
1851
|
+
"reconciliationJson" text,
|
|
1852
|
+
CONSTRAINT shared_resource_leases_caller_check CHECK (((("callerKind" = 'direct'::text) AND ("delegationId" IS NULL)) OR (("callerKind" = 'delegated'::text) AND ("delegationId" IS NOT NULL)))),
|
|
1853
|
+
CONSTRAINT shared_resource_leases_digest_check CHECK ((("requestSha256" ~ '^[a-f0-9]{64}$'::text) AND ("missionAssertionSha256" ~ '^[a-f0-9]{64}$'::text) AND (("evidenceSha256" IS NULL) OR ("evidenceSha256" ~ '^[a-f0-9]{64}$'::text)) AND (("settlementRecordSha256" IS NULL) OR ("settlementRecordSha256" ~ '^[a-f0-9]{64}$'::text)))),
|
|
1854
|
+
CONSTRAINT shared_resource_leases_mission_evidence_check CHECK ((((("missionAssertionJson")::jsonb ->> 'issuer'::text) = "missionIssuer") AND ((("missionAssertionJson")::jsonb ->> 'keyId'::text) = "missionKeyId") AND (COALESCE((("missionAssertionJson")::jsonb ->> 'signature'::text), ''::text) ~ '^[A-Za-z0-9+/]{80,128}={0,2}$'::text))),
|
|
1855
|
+
CONSTRAINT shared_resource_leases_revision_check CHECK (("missionRevision" > 0)),
|
|
1856
|
+
CONSTRAINT shared_resource_leases_settlement_check CHECK ((((state = 'released'::text) AND ("settledAt" IS NOT NULL) AND (settlement IS NOT NULL) AND ("evidenceSha256" IS NOT NULL) AND ("settlementRecordSha256" IS NOT NULL)) OR ((state <> 'released'::text) AND ("settledAt" IS NULL) AND (settlement IS NULL) AND ("evidenceSha256" IS NULL) AND ("settlementRecordSha256" IS NULL) AND ("terminalEvidenceJson" IS NULL) AND ("reconciliationDecisionId" IS NULL) AND ("reconciliationJson" IS NULL)))),
|
|
1857
|
+
CONSTRAINT shared_resource_leases_started_check CHECK ((((state = 'reserved'::text) AND ("startedAt" IS NULL)) OR ((state = ANY (ARRAY['running'::text, 'unknown'::text])) AND ("startedAt" IS NOT NULL) AND ("startedAt" >= "acquiredAt")) OR ((state = 'released'::text) AND (("startedAt" IS NULL) OR ("startedAt" >= "acquiredAt"))))),
|
|
1858
|
+
CONSTRAINT shared_resource_leases_state_check CHECK ((state = ANY (ARRAY['reserved'::text, 'running'::text, 'unknown'::text, 'released'::text])))
|
|
1859
|
+
);
|
|
1860
|
+
|
|
1861
|
+
CREATE TABLE public.skill_installations (
|
|
1862
|
+
id text NOT NULL,
|
|
1863
|
+
"skillName" text NOT NULL,
|
|
1864
|
+
"nodeId" text NOT NULL,
|
|
1865
|
+
version text NOT NULL,
|
|
1866
|
+
status text DEFAULT 'available'::text NOT NULL,
|
|
1867
|
+
"registryEntryId" text,
|
|
1868
|
+
"versionHash" text,
|
|
1869
|
+
"installedAt" timestamp(3) without time zone,
|
|
1870
|
+
error text,
|
|
1871
|
+
"bundleSha256" text,
|
|
1872
|
+
"treeSha256" text,
|
|
1873
|
+
"workflowCommandId" text,
|
|
1874
|
+
"workflowRequestSha256" text,
|
|
1875
|
+
"workflowReceiptSha256" text,
|
|
1876
|
+
CONSTRAINT "skill_installations_bundleSha256_format" CHECK ((("bundleSha256" IS NULL) OR ("bundleSha256" ~ '^[a-f0-9]{64}$'::text))),
|
|
1877
|
+
CONSTRAINT skill_installations_installed_workflow_receipt CHECK ((("workflowCommandId" IS NULL) OR (status <> 'installed'::text) OR (("workflowRequestSha256" IS NOT NULL) AND ("workflowReceiptSha256" IS NOT NULL)))),
|
|
1878
|
+
CONSTRAINT "skill_installations_treeSha256_format" CHECK ((("treeSha256" IS NULL) OR ("treeSha256" ~ '^[a-f0-9]{64}$'::text))),
|
|
1879
|
+
CONSTRAINT "skill_installations_workflowCommandId_format" CHECK ((("workflowCommandId" IS NULL) OR ("workflowCommandId" ~ '^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$'::text))),
|
|
1880
|
+
CONSTRAINT "skill_installations_workflowReceiptSha256_format" CHECK ((("workflowReceiptSha256" IS NULL) OR ("workflowReceiptSha256" ~ '^[a-f0-9]{64}$'::text))),
|
|
1881
|
+
CONSTRAINT "skill_installations_workflowRequestSha256_format" CHECK ((("workflowRequestSha256" IS NULL) OR ("workflowRequestSha256" ~ '^[a-f0-9]{64}$'::text))),
|
|
1882
|
+
CONSTRAINT skill_installations_workflow_identity_complete CHECK ((("workflowCommandId" IS NULL) OR (("bundleSha256" IS NOT NULL) AND ("treeSha256" IS NOT NULL))))
|
|
1883
|
+
);
|
|
1884
|
+
|
|
1885
|
+
CREATE TABLE public.skill_registry_entries (
|
|
1886
|
+
id text NOT NULL,
|
|
1887
|
+
slug text NOT NULL,
|
|
1888
|
+
"displayName" text NOT NULL,
|
|
1889
|
+
description text DEFAULT ''::text NOT NULL,
|
|
1890
|
+
author text DEFAULT ''::text NOT NULL,
|
|
1891
|
+
source text DEFAULT 'local'::text NOT NULL,
|
|
1892
|
+
"sourceUrl" text,
|
|
1893
|
+
"entryPoint" text DEFAULT 'run.sh'::text NOT NULL,
|
|
1894
|
+
dependencies text DEFAULT '[]'::text NOT NULL,
|
|
1895
|
+
metadata text DEFAULT '{}'::text NOT NULL,
|
|
1896
|
+
"latestVersion" text,
|
|
1897
|
+
status text DEFAULT 'active'::text NOT NULL,
|
|
1898
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1899
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1900
|
+
);
|
|
1901
|
+
|
|
1902
|
+
CREATE TABLE public.skill_tags (
|
|
1903
|
+
id text NOT NULL,
|
|
1904
|
+
"skillId" text NOT NULL,
|
|
1905
|
+
tag text NOT NULL,
|
|
1906
|
+
"versionId" text NOT NULL,
|
|
1907
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1908
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1909
|
+
);
|
|
1910
|
+
|
|
1911
|
+
CREATE TABLE public.skill_versions (
|
|
1912
|
+
id text NOT NULL,
|
|
1913
|
+
"skillId" text NOT NULL,
|
|
1914
|
+
version text NOT NULL,
|
|
1915
|
+
changelog text DEFAULT ''::text NOT NULL,
|
|
1916
|
+
"contentHash" text NOT NULL,
|
|
1917
|
+
files text DEFAULT '[]'::text NOT NULL,
|
|
1918
|
+
"entryPoint" text DEFAULT 'run.sh'::text NOT NULL,
|
|
1919
|
+
"sizeBytes" integer DEFAULT 0 NOT NULL,
|
|
1920
|
+
"publishedBy" text DEFAULT 'system'::text NOT NULL,
|
|
1921
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1922
|
+
);
|
|
1923
|
+
|
|
1924
|
+
CREATE TABLE public.team_approval_decisions (
|
|
1925
|
+
"decisionId" text NOT NULL,
|
|
1926
|
+
"proposalId" text NOT NULL,
|
|
1927
|
+
"proposalRevision" integer NOT NULL,
|
|
1928
|
+
"planSha256" text NOT NULL,
|
|
1929
|
+
decision text NOT NULL,
|
|
1930
|
+
"assertionSha256" text NOT NULL,
|
|
1931
|
+
"actorBindingSha256" text NOT NULL,
|
|
1932
|
+
"executionId" text,
|
|
1933
|
+
"decidedAt" timestamp(3) without time zone NOT NULL,
|
|
1934
|
+
"expiresAt" timestamp(3) without time zone NOT NULL,
|
|
1935
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1936
|
+
CONSTRAINT team_approval_decision_kind CHECK ((decision = ANY (ARRAY['approve'::text, 'reject'::text]))),
|
|
1937
|
+
CONSTRAINT team_approval_execution_binding CHECK (((decision = 'approve'::text) = ("executionId" IS NOT NULL)))
|
|
1938
|
+
);
|
|
1939
|
+
|
|
1940
|
+
CREATE TABLE public.users (
|
|
1941
|
+
id text NOT NULL,
|
|
1942
|
+
email text NOT NULL,
|
|
1943
|
+
name text NOT NULL,
|
|
1944
|
+
password text NOT NULL,
|
|
1945
|
+
role public."UserRole" DEFAULT 'VIEWER'::public."UserRole" NOT NULL,
|
|
1946
|
+
active boolean DEFAULT true NOT NULL,
|
|
1947
|
+
"lastLoginAt" timestamp(3) without time zone,
|
|
1948
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1949
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1950
|
+
);
|
|
1951
|
+
|
|
1952
|
+
CREATE TABLE public.webhook_deliveries (
|
|
1953
|
+
id text NOT NULL,
|
|
1954
|
+
"endpointId" text NOT NULL,
|
|
1955
|
+
event text NOT NULL,
|
|
1956
|
+
payload text NOT NULL,
|
|
1957
|
+
status text DEFAULT 'pending'::text NOT NULL,
|
|
1958
|
+
"httpStatus" integer,
|
|
1959
|
+
response text,
|
|
1960
|
+
error text,
|
|
1961
|
+
attempts integer DEFAULT 0 NOT NULL,
|
|
1962
|
+
"deliveredAt" timestamp(3) without time zone,
|
|
1963
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
1964
|
+
);
|
|
1965
|
+
|
|
1966
|
+
CREATE TABLE public.webhook_endpoints (
|
|
1967
|
+
id text NOT NULL,
|
|
1968
|
+
name text NOT NULL,
|
|
1969
|
+
url text NOT NULL,
|
|
1970
|
+
type text DEFAULT 'generic'::text NOT NULL,
|
|
1971
|
+
secret text,
|
|
1972
|
+
events text DEFAULT '[]'::text NOT NULL,
|
|
1973
|
+
headers text NOT NULL,
|
|
1974
|
+
active boolean DEFAULT true NOT NULL,
|
|
1975
|
+
retries integer DEFAULT 3 NOT NULL,
|
|
1976
|
+
"timeoutMs" integer DEFAULT 10000 NOT NULL,
|
|
1977
|
+
"createdBy" text,
|
|
1978
|
+
"createdAt" timestamp(3) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
1979
|
+
"updatedAt" timestamp(3) without time zone NOT NULL
|
|
1980
|
+
);
|
|
1981
|
+
|
|
1982
|
+
ALTER TABLE ONLY public.a2a_tasks
|
|
1983
|
+
ADD CONSTRAINT a2a_tasks_pkey PRIMARY KEY (id);
|
|
1984
|
+
|
|
1985
|
+
ALTER TABLE ONLY public.agents
|
|
1986
|
+
ADD CONSTRAINT agents_pkey PRIMARY KEY (id);
|
|
1987
|
+
|
|
1988
|
+
ALTER TABLE ONLY public.ai_conversations
|
|
1989
|
+
ADD CONSTRAINT ai_conversations_pkey PRIMARY KEY (id);
|
|
1990
|
+
|
|
1991
|
+
ALTER TABLE ONLY public.ai_dashboards
|
|
1992
|
+
ADD CONSTRAINT ai_dashboards_pkey PRIMARY KEY (id);
|
|
1993
|
+
|
|
1994
|
+
ALTER TABLE ONLY public.ai_memories
|
|
1995
|
+
ADD CONSTRAINT ai_memories_pkey PRIMARY KEY (id);
|
|
1996
|
+
|
|
1997
|
+
ALTER TABLE ONLY public.ai_messages
|
|
1998
|
+
ADD CONSTRAINT ai_messages_pkey PRIMARY KEY (id);
|
|
1999
|
+
|
|
2000
|
+
ALTER TABLE ONLY public.ai_scheduled_ops
|
|
2001
|
+
ADD CONSTRAINT ai_scheduled_ops_pkey PRIMARY KEY (id);
|
|
2002
|
+
|
|
2003
|
+
ALTER TABLE ONLY public.alert_condition_states
|
|
2004
|
+
ADD CONSTRAINT alert_condition_states_pkey PRIMARY KEY ("ruleId", "nodeId");
|
|
2005
|
+
|
|
2006
|
+
ALTER TABLE ONLY public.alert_rules
|
|
2007
|
+
ADD CONSTRAINT alert_rules_pkey PRIMARY KEY (id);
|
|
2008
|
+
|
|
2009
|
+
ALTER TABLE ONLY public.alert_violations
|
|
2010
|
+
ADD CONSTRAINT alert_violations_pkey PRIMARY KEY (id);
|
|
2011
|
+
|
|
2012
|
+
ALTER TABLE ONLY public.anomaly_events
|
|
2013
|
+
ADD CONSTRAINT anomaly_events_pkey PRIMARY KEY (id);
|
|
2014
|
+
|
|
2015
|
+
ALTER TABLE ONLY public.application_observations
|
|
2016
|
+
ADD CONSTRAINT application_observations_pkey PRIMARY KEY (id);
|
|
2017
|
+
|
|
2018
|
+
ALTER TABLE ONLY public.ardent_installations
|
|
2019
|
+
ADD CONSTRAINT ardent_installations_pkey PRIMARY KEY (id);
|
|
2020
|
+
|
|
2021
|
+
ALTER TABLE ONLY public.ardent_profiles
|
|
2022
|
+
ADD CONSTRAINT ardent_profiles_pkey PRIMARY KEY (id);
|
|
2023
|
+
|
|
2024
|
+
ALTER TABLE ONLY public.ardent_scope_enrollments
|
|
2025
|
+
ADD CONSTRAINT ardent_scope_enrollments_pkey PRIMARY KEY ("nodeId");
|
|
2026
|
+
|
|
2027
|
+
ALTER TABLE ONLY public.command_resource_fences
|
|
2028
|
+
ADD CONSTRAINT command_resource_fences_pkey PRIMARY KEY ("resourceKey");
|
|
2029
|
+
|
|
2030
|
+
ALTER TABLE ONLY public.command_resource_leases
|
|
2031
|
+
ADD CONSTRAINT command_resource_leases_pkey PRIMARY KEY (id);
|
|
2032
|
+
|
|
2033
|
+
ALTER TABLE ONLY public.command_results
|
|
2034
|
+
ADD CONSTRAINT command_results_pkey PRIMARY KEY (id);
|
|
2035
|
+
|
|
2036
|
+
ALTER TABLE ONLY public.council_admission_fences
|
|
2037
|
+
ADD CONSTRAINT council_admission_fences_pkey PRIMARY KEY ("nodeId");
|
|
2038
|
+
|
|
2039
|
+
ALTER TABLE ONLY public.cron_job_executions
|
|
2040
|
+
ADD CONSTRAINT cron_job_executions_pkey PRIMARY KEY (id);
|
|
2041
|
+
|
|
2042
|
+
ALTER TABLE ONLY public.cron_jobs
|
|
2043
|
+
ADD CONSTRAINT cron_jobs_pkey PRIMARY KEY (id);
|
|
2044
|
+
|
|
2045
|
+
ALTER TABLE ONLY public.deploy_jobs
|
|
2046
|
+
ADD CONSTRAINT deploy_jobs_pkey PRIMARY KEY (id);
|
|
2047
|
+
|
|
2048
|
+
ALTER TABLE ONLY public.drift_scans
|
|
2049
|
+
ADD CONSTRAINT drift_scans_pkey PRIMARY KEY (id);
|
|
2050
|
+
|
|
2051
|
+
ALTER TABLE ONLY public.engineering_metric_samples
|
|
2052
|
+
ADD CONSTRAINT engineering_metric_samples_pkey PRIMARY KEY (id);
|
|
2053
|
+
|
|
2054
|
+
ALTER TABLE ONLY public.engineering_recovery_exercises
|
|
2055
|
+
ADD CONSTRAINT engineering_recovery_exercises_pkey PRIMARY KEY (id);
|
|
2056
|
+
|
|
2057
|
+
ALTER TABLE ONLY public.execution_runs
|
|
2058
|
+
ADD CONSTRAINT execution_runs_pkey PRIMARY KEY (id);
|
|
2059
|
+
|
|
2060
|
+
ALTER TABLE ONLY public.file_patch_tasks
|
|
2061
|
+
ADD CONSTRAINT file_patch_tasks_pkey PRIMARY KEY (id);
|
|
2062
|
+
|
|
2063
|
+
ALTER TABLE ONLY public.gpu_snapshots
|
|
2064
|
+
ADD CONSTRAINT gpu_snapshots_pkey PRIMARY KEY (id);
|
|
2065
|
+
|
|
2066
|
+
ALTER TABLE ONLY public.health_snapshots
|
|
2067
|
+
ADD CONSTRAINT health_snapshots_pkey PRIMARY KEY (id);
|
|
2068
|
+
|
|
2069
|
+
ALTER TABLE ONLY public.hermes_core_rollout_hosts
|
|
2070
|
+
ADD CONSTRAINT hermes_core_rollout_hosts_pkey PRIMARY KEY (id);
|
|
2071
|
+
|
|
2072
|
+
ALTER TABLE ONLY public.hermes_core_rollouts
|
|
2073
|
+
ADD CONSTRAINT hermes_core_rollouts_pkey PRIMARY KEY (id);
|
|
2074
|
+
|
|
2075
|
+
ALTER TABLE ONLY public.hermes_credential_pool_attachments
|
|
2076
|
+
ADD CONSTRAINT hermes_credential_pool_attachments_pkey PRIMARY KEY (id);
|
|
2077
|
+
|
|
2078
|
+
ALTER TABLE ONLY public.hermes_credential_pools
|
|
2079
|
+
ADD CONSTRAINT hermes_credential_pools_pkey PRIMARY KEY (id);
|
|
2080
|
+
|
|
2081
|
+
ALTER TABLE ONLY public.hermes_cron_jobs
|
|
2082
|
+
ADD CONSTRAINT hermes_cron_jobs_pkey PRIMARY KEY (id);
|
|
2083
|
+
|
|
2084
|
+
ALTER TABLE ONLY public.hermes_hooks
|
|
2085
|
+
ADD CONSTRAINT hermes_hooks_pkey PRIMARY KEY (id);
|
|
2086
|
+
|
|
2087
|
+
ALTER TABLE ONLY public.hermes_installations
|
|
2088
|
+
ADD CONSTRAINT hermes_installations_pkey PRIMARY KEY (id);
|
|
2089
|
+
|
|
2090
|
+
ALTER TABLE ONLY public.hermes_mcp_server_attachments
|
|
2091
|
+
ADD CONSTRAINT hermes_mcp_server_attachments_pkey PRIMARY KEY (id);
|
|
2092
|
+
|
|
2093
|
+
ALTER TABLE ONLY public.hermes_mcp_servers
|
|
2094
|
+
ADD CONSTRAINT hermes_mcp_servers_pkey PRIMARY KEY (id);
|
|
2095
|
+
|
|
2096
|
+
ALTER TABLE ONLY public.hermes_messaging_bindings
|
|
2097
|
+
ADD CONSTRAINT hermes_messaging_bindings_pkey PRIMARY KEY (id);
|
|
2098
|
+
|
|
2099
|
+
ALTER TABLE ONLY public.hermes_operation_jobs
|
|
2100
|
+
ADD CONSTRAINT hermes_operation_jobs_pkey PRIMARY KEY (id);
|
|
2101
|
+
|
|
2102
|
+
ALTER TABLE ONLY public.hermes_plugin_installs
|
|
2103
|
+
ADD CONSTRAINT hermes_plugin_installs_pkey PRIMARY KEY (id);
|
|
2104
|
+
|
|
2105
|
+
ALTER TABLE ONLY public.hermes_profiles
|
|
2106
|
+
ADD CONSTRAINT hermes_profiles_pkey PRIMARY KEY (id);
|
|
2107
|
+
|
|
2108
|
+
ALTER TABLE ONLY public.hermes_provider_configs
|
|
2109
|
+
ADD CONSTRAINT hermes_provider_configs_pkey PRIMARY KEY (id);
|
|
2110
|
+
|
|
2111
|
+
ALTER TABLE ONLY public.hermes_registry_clients
|
|
2112
|
+
ADD CONSTRAINT hermes_registry_clients_pkey PRIMARY KEY (id);
|
|
2113
|
+
|
|
2114
|
+
ALTER TABLE ONLY public.hermes_registry_inventory
|
|
2115
|
+
ADD CONSTRAINT hermes_registry_inventory_pkey PRIMARY KEY (id);
|
|
2116
|
+
|
|
2117
|
+
ALTER TABLE ONLY public.hermes_registry_receipts
|
|
2118
|
+
ADD CONSTRAINT hermes_registry_receipts_pkey PRIMARY KEY (id);
|
|
2119
|
+
|
|
2120
|
+
ALTER TABLE ONLY public.hermes_registry_revisions
|
|
2121
|
+
ADD CONSTRAINT hermes_registry_revisions_pkey PRIMARY KEY (id);
|
|
2122
|
+
|
|
2123
|
+
ALTER TABLE ONLY public.hermes_registry_targets
|
|
2124
|
+
ADD CONSTRAINT hermes_registry_targets_pkey PRIMARY KEY (id);
|
|
2125
|
+
|
|
2126
|
+
ALTER TABLE ONLY public.hermes_role_applications
|
|
2127
|
+
ADD CONSTRAINT hermes_role_applications_pkey PRIMARY KEY (id);
|
|
2128
|
+
|
|
2129
|
+
ALTER TABLE ONLY public.hermes_roles
|
|
2130
|
+
ADD CONSTRAINT hermes_roles_pkey PRIMARY KEY (id);
|
|
2131
|
+
|
|
2132
|
+
ALTER TABLE ONLY public.hermes_skill_assignments
|
|
2133
|
+
ADD CONSTRAINT hermes_skill_assignments_pkey PRIMARY KEY (id);
|
|
2134
|
+
|
|
2135
|
+
ALTER TABLE ONLY public.hermes_toolset_policies
|
|
2136
|
+
ADD CONSTRAINT hermes_toolset_policies_pkey PRIMARY KEY (id);
|
|
2137
|
+
|
|
2138
|
+
ALTER TABLE ONLY public.incident_lessons
|
|
2139
|
+
ADD CONSTRAINT incident_lessons_pkey PRIMARY KEY (id);
|
|
2140
|
+
|
|
2141
|
+
ALTER TABLE ONLY public.library_categories
|
|
2142
|
+
ADD CONSTRAINT library_categories_pkey PRIMARY KEY (id);
|
|
2143
|
+
|
|
2144
|
+
ALTER TABLE ONLY public.library_files
|
|
2145
|
+
ADD CONSTRAINT library_files_pkey PRIMARY KEY (id);
|
|
2146
|
+
|
|
2147
|
+
ALTER TABLE ONLY public.log_entries
|
|
2148
|
+
ADD CONSTRAINT log_entries_pkey PRIMARY KEY (id);
|
|
2149
|
+
|
|
2150
|
+
ALTER TABLE ONLY public.magnus_release_canaries
|
|
2151
|
+
ADD CONSTRAINT magnus_release_canaries_pkey PRIMARY KEY ("tokenSha256");
|
|
2152
|
+
|
|
2153
|
+
ALTER TABLE ONLY public.maintenance_windows
|
|
2154
|
+
ADD CONSTRAINT maintenance_windows_pkey PRIMARY KEY (id);
|
|
2155
|
+
|
|
2156
|
+
ALTER TABLE ONLY public.managed_cron_definitions
|
|
2157
|
+
ADD CONSTRAINT managed_cron_definitions_pkey PRIMARY KEY ("cronJobId");
|
|
2158
|
+
|
|
2159
|
+
ALTER TABLE ONLY public.managed_cron_occurrences
|
|
2160
|
+
ADD CONSTRAINT managed_cron_occurrences_pkey PRIMARY KEY (id);
|
|
2161
|
+
|
|
2162
|
+
ALTER TABLE ONLY public.nodes
|
|
2163
|
+
ADD CONSTRAINT nodes_pkey PRIMARY KEY (id);
|
|
2164
|
+
|
|
2165
|
+
ALTER TABLE ONLY public.notification_preferences
|
|
2166
|
+
ADD CONSTRAINT notification_preferences_pkey PRIMARY KEY (id);
|
|
2167
|
+
|
|
2168
|
+
ALTER TABLE ONLY public.notifications
|
|
2169
|
+
ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);
|
|
2170
|
+
|
|
2171
|
+
ALTER TABLE ONLY public.remediation_executions
|
|
2172
|
+
ADD CONSTRAINT remediation_executions_pkey PRIMARY KEY (id);
|
|
2173
|
+
|
|
2174
|
+
ALTER TABLE ONLY public.remediation_rules
|
|
2175
|
+
ADD CONSTRAINT remediation_rules_pkey PRIMARY KEY (id);
|
|
2176
|
+
|
|
2177
|
+
ALTER TABLE ONLY public.remote_commands
|
|
2178
|
+
ADD CONSTRAINT remote_commands_pkey PRIMARY KEY (id);
|
|
2179
|
+
|
|
2180
|
+
ALTER TABLE ONLY public.resource_drain_participants
|
|
2181
|
+
ADD CONSTRAINT resource_drain_participants_pkey PRIMARY KEY ("nodeId", participant);
|
|
2182
|
+
|
|
2183
|
+
ALTER TABLE ONLY public.resource_enrollments
|
|
2184
|
+
ADD CONSTRAINT resource_enrollments_pkey PRIMARY KEY ("nodeId");
|
|
2185
|
+
|
|
2186
|
+
ALTER TABLE ONLY public.resource_participant_work
|
|
2187
|
+
ADD CONSTRAINT resource_participant_work_pkey PRIMARY KEY ("workId");
|
|
2188
|
+
|
|
2189
|
+
ALTER TABLE ONLY public.role_applications
|
|
2190
|
+
ADD CONSTRAINT role_applications_pkey PRIMARY KEY (id);
|
|
2191
|
+
|
|
2192
|
+
ALTER TABLE ONLY public.roles
|
|
2193
|
+
ADD CONSTRAINT roles_pkey PRIMARY KEY (id);
|
|
2194
|
+
|
|
2195
|
+
ALTER TABLE ONLY public.rollout_targets
|
|
2196
|
+
ADD CONSTRAINT rollout_targets_pkey PRIMARY KEY (id);
|
|
2197
|
+
|
|
2198
|
+
ALTER TABLE ONLY public.security_export_outbox
|
|
2199
|
+
ADD CONSTRAINT security_export_outbox_pkey PRIMARY KEY (id);
|
|
2200
|
+
|
|
2201
|
+
ALTER TABLE ONLY public.security_fusion_action_approvals
|
|
2202
|
+
ADD CONSTRAINT security_fusion_action_approvals_pkey PRIMARY KEY (id);
|
|
2203
|
+
|
|
2204
|
+
ALTER TABLE ONLY public.security_fusion_actions
|
|
2205
|
+
ADD CONSTRAINT security_fusion_actions_pkey PRIMARY KEY (id);
|
|
2206
|
+
|
|
2207
|
+
ALTER TABLE ONLY public.security_fusion_case_activity
|
|
2208
|
+
ADD CONSTRAINT security_fusion_case_activity_pkey PRIMARY KEY (id);
|
|
2209
|
+
|
|
2210
|
+
ALTER TABLE ONLY public.security_fusion_case_entities
|
|
2211
|
+
ADD CONSTRAINT security_fusion_case_entities_pkey PRIMARY KEY (id);
|
|
2212
|
+
|
|
2213
|
+
ALTER TABLE ONLY public.security_fusion_case_events
|
|
2214
|
+
ADD CONSTRAINT security_fusion_case_events_pkey PRIMARY KEY (id);
|
|
2215
|
+
|
|
2216
|
+
ALTER TABLE ONLY public.security_fusion_case_relationships
|
|
2217
|
+
ADD CONSTRAINT security_fusion_case_relationships_pkey PRIMARY KEY (id);
|
|
2218
|
+
|
|
2219
|
+
ALTER TABLE ONLY public.security_fusion_cases
|
|
2220
|
+
ADD CONSTRAINT security_fusion_cases_pkey PRIMARY KEY (id);
|
|
2221
|
+
|
|
2222
|
+
ALTER TABLE ONLY public.security_fusion_collectors
|
|
2223
|
+
ADD CONSTRAINT security_fusion_collectors_pkey PRIMARY KEY (id);
|
|
2224
|
+
|
|
2225
|
+
ALTER TABLE ONLY public.security_fusion_command_outbox
|
|
2226
|
+
ADD CONSTRAINT security_fusion_command_outbox_pkey PRIMARY KEY (id);
|
|
2227
|
+
|
|
2228
|
+
ALTER TABLE ONLY public.security_fusion_deletion_receipts
|
|
2229
|
+
ADD CONSTRAINT security_fusion_deletion_receipts_pkey PRIMARY KEY (id);
|
|
2230
|
+
|
|
2231
|
+
ALTER TABLE ONLY public.security_fusion_deliveries
|
|
2232
|
+
ADD CONSTRAINT security_fusion_deliveries_pkey PRIMARY KEY (id);
|
|
2233
|
+
|
|
2234
|
+
ALTER TABLE ONLY public.security_fusion_entities
|
|
2235
|
+
ADD CONSTRAINT security_fusion_entities_pkey PRIMARY KEY (id);
|
|
2236
|
+
|
|
2237
|
+
ALTER TABLE ONLY public.security_fusion_entity_aliases
|
|
2238
|
+
ADD CONSTRAINT security_fusion_entity_aliases_pkey PRIMARY KEY (id);
|
|
2239
|
+
|
|
2240
|
+
ALTER TABLE ONLY public.security_fusion_event_entities
|
|
2241
|
+
ADD CONSTRAINT security_fusion_event_entities_pkey PRIMARY KEY (id);
|
|
2242
|
+
|
|
2243
|
+
ALTER TABLE ONLY public.security_fusion_events
|
|
2244
|
+
ADD CONSTRAINT security_fusion_events_pkey PRIMARY KEY (id);
|
|
2245
|
+
|
|
2246
|
+
ALTER TABLE ONLY public.security_fusion_evidence
|
|
2247
|
+
ADD CONSTRAINT security_fusion_evidence_pkey PRIMARY KEY (id);
|
|
2248
|
+
|
|
2249
|
+
ALTER TABLE ONLY public.security_fusion_investigations
|
|
2250
|
+
ADD CONSTRAINT security_fusion_investigations_pkey PRIMARY KEY (id);
|
|
2251
|
+
|
|
2252
|
+
ALTER TABLE ONLY public.security_fusion_nonces
|
|
2253
|
+
ADD CONSTRAINT security_fusion_nonces_pkey PRIMARY KEY (nonce);
|
|
2254
|
+
|
|
2255
|
+
ALTER TABLE ONLY public.security_fusion_receipt_chain_heads
|
|
2256
|
+
ADD CONSTRAINT security_fusion_receipt_chain_heads_pkey PRIMARY KEY (id);
|
|
2257
|
+
|
|
2258
|
+
ALTER TABLE ONLY public.security_fusion_rule_versions
|
|
2259
|
+
ADD CONSTRAINT security_fusion_rule_versions_pkey PRIMARY KEY (id);
|
|
2260
|
+
|
|
2261
|
+
ALTER TABLE ONLY public.security_fusion_source_state
|
|
2262
|
+
ADD CONSTRAINT security_fusion_source_state_pkey PRIMARY KEY (id);
|
|
2263
|
+
|
|
2264
|
+
ALTER TABLE ONLY public.security_service_states
|
|
2265
|
+
ADD CONSTRAINT security_service_states_pkey PRIMARY KEY ("nodeId", "serviceName");
|
|
2266
|
+
|
|
2267
|
+
ALTER TABLE ONLY public.shared_resource_fences
|
|
2268
|
+
ADD CONSTRAINT shared_resource_fences_pkey PRIMARY KEY ("resourceKey");
|
|
2269
|
+
|
|
2270
|
+
ALTER TABLE ONLY public.shared_resource_lease_resources
|
|
2271
|
+
ADD CONSTRAINT shared_resource_lease_resources_pkey PRIMARY KEY ("leaseId", "resourceKey");
|
|
2272
|
+
|
|
2273
|
+
ALTER TABLE ONLY public.shared_resource_leases
|
|
2274
|
+
ADD CONSTRAINT shared_resource_leases_pkey PRIMARY KEY (id);
|
|
2275
|
+
|
|
2276
|
+
ALTER TABLE ONLY public.skill_installations
|
|
2277
|
+
ADD CONSTRAINT skill_installations_pkey PRIMARY KEY (id);
|
|
2278
|
+
|
|
2279
|
+
ALTER TABLE ONLY public.skill_registry_entries
|
|
2280
|
+
ADD CONSTRAINT skill_registry_entries_pkey PRIMARY KEY (id);
|
|
2281
|
+
|
|
2282
|
+
ALTER TABLE ONLY public.skill_tags
|
|
2283
|
+
ADD CONSTRAINT skill_tags_pkey PRIMARY KEY (id);
|
|
2284
|
+
|
|
2285
|
+
ALTER TABLE ONLY public.skill_versions
|
|
2286
|
+
ADD CONSTRAINT skill_versions_pkey PRIMARY KEY (id);
|
|
2287
|
+
|
|
2288
|
+
ALTER TABLE ONLY public.team_approval_decisions
|
|
2289
|
+
ADD CONSTRAINT team_approval_decisions_pkey PRIMARY KEY ("decisionId");
|
|
2290
|
+
|
|
2291
|
+
ALTER TABLE ONLY public.users
|
|
2292
|
+
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
|
|
2293
|
+
|
|
2294
|
+
ALTER TABLE ONLY public.webhook_deliveries
|
|
2295
|
+
ADD CONSTRAINT webhook_deliveries_pkey PRIMARY KEY (id);
|
|
2296
|
+
|
|
2297
|
+
ALTER TABLE ONLY public.webhook_endpoints
|
|
2298
|
+
ADD CONSTRAINT webhook_endpoints_pkey PRIMARY KEY (id);
|
|
2299
|
+
|
|
2300
|
+
CREATE INDEX "a2a_tasks_fromAgent_idx" ON public.a2a_tasks USING btree ("fromAgent");
|
|
2301
|
+
|
|
2302
|
+
CREATE INDEX a2a_tasks_status_idx ON public.a2a_tasks USING btree (status);
|
|
2303
|
+
|
|
2304
|
+
CREATE INDEX "a2a_tasks_toAgent_idx" ON public.a2a_tasks USING btree ("toAgent");
|
|
2305
|
+
|
|
2306
|
+
CREATE UNIQUE INDEX "agents_nodeId_key" ON public.agents USING btree ("nodeId");
|
|
2307
|
+
|
|
2308
|
+
CREATE INDEX "ai_conversations_forkedFromMessageId_idx" ON public.ai_conversations USING btree ("forkedFromMessageId");
|
|
2309
|
+
|
|
2310
|
+
CREATE INDEX "ai_conversations_nodeId_idx" ON public.ai_conversations USING btree ("nodeId");
|
|
2311
|
+
|
|
2312
|
+
CREATE INDEX "ai_conversations_parentId_updatedAt_idx" ON public.ai_conversations USING btree ("parentId", "updatedAt");
|
|
2313
|
+
|
|
2314
|
+
CREATE INDEX "ai_conversations_status_createdAt_idx" ON public.ai_conversations USING btree (status, "createdAt");
|
|
2315
|
+
|
|
2316
|
+
CREATE INDEX "ai_conversations_type_createdAt_idx" ON public.ai_conversations USING btree (type, "createdAt");
|
|
2317
|
+
|
|
2318
|
+
CREATE INDEX "ai_dashboards_createdBy_idx" ON public.ai_dashboards USING btree ("createdBy");
|
|
2319
|
+
|
|
2320
|
+
CREATE INDEX ai_memories_category_idx ON public.ai_memories USING btree (category);
|
|
2321
|
+
|
|
2322
|
+
CREATE UNIQUE INDEX ai_memories_key_key ON public.ai_memories USING btree (key);
|
|
2323
|
+
|
|
2324
|
+
CREATE INDEX ai_memories_relevance_idx ON public.ai_memories USING btree (relevance);
|
|
2325
|
+
|
|
2326
|
+
CREATE INDEX "ai_messages_conversationId_createdAt_idx" ON public.ai_messages USING btree ("conversationId", "createdAt");
|
|
2327
|
+
|
|
2328
|
+
CREATE INDEX "ai_messages_role_isRead_idx" ON public.ai_messages USING btree (role, "isRead");
|
|
2329
|
+
|
|
2330
|
+
CREATE INDEX "ai_scheduled_ops_enabled_nextRunAt_idx" ON public.ai_scheduled_ops USING btree (enabled, "nextRunAt");
|
|
2331
|
+
|
|
2332
|
+
CREATE INDEX "alert_condition_states_nodeId_idx" ON public.alert_condition_states USING btree ("nodeId");
|
|
2333
|
+
|
|
2334
|
+
CREATE INDEX alert_rules_active_idx ON public.alert_rules USING btree (active);
|
|
2335
|
+
|
|
2336
|
+
CREATE INDEX alert_rules_metric_idx ON public.alert_rules USING btree (metric);
|
|
2337
|
+
|
|
2338
|
+
CREATE INDEX "alert_violations_nodeId_status_idx" ON public.alert_violations USING btree ("nodeId", status);
|
|
2339
|
+
|
|
2340
|
+
CREATE INDEX "alert_violations_ruleId_status_idx" ON public.alert_violations USING btree ("ruleId", status);
|
|
2341
|
+
|
|
2342
|
+
CREATE INDEX "alert_violations_status_createdAt_idx" ON public.alert_violations USING btree (status, "createdAt");
|
|
2343
|
+
|
|
2344
|
+
CREATE INDEX "anomaly_events_healthSnapshotId_idx" ON public.anomaly_events USING btree ("healthSnapshotId");
|
|
2345
|
+
|
|
2346
|
+
CREATE INDEX "anomaly_events_metric_createdAt_idx" ON public.anomaly_events USING btree (metric, "createdAt");
|
|
2347
|
+
|
|
2348
|
+
CREATE INDEX "anomaly_events_nodeId_createdAt_idx" ON public.anomaly_events USING btree ("nodeId", "createdAt");
|
|
2349
|
+
|
|
2350
|
+
CREATE INDEX "anomaly_events_nodeId_metric_resolved_idx" ON public.anomaly_events USING btree ("nodeId", metric, resolved);
|
|
2351
|
+
|
|
2352
|
+
CREATE INDEX "anomaly_events_resolved_createdAt_idx" ON public.anomaly_events USING btree (resolved, "createdAt");
|
|
2353
|
+
|
|
2354
|
+
CREATE INDEX "application_observations_nodeId_idx" ON public.application_observations USING btree ("nodeId");
|
|
2355
|
+
|
|
2356
|
+
CREATE UNIQUE INDEX "ardent_installations_nodeId_key" ON public.ardent_installations USING btree ("nodeId");
|
|
2357
|
+
|
|
2358
|
+
CREATE INDEX "ardent_installations_reachable_checkedAt_idx" ON public.ardent_installations USING btree (reachable, "checkedAt");
|
|
2359
|
+
|
|
2360
|
+
CREATE UNIQUE INDEX "ardent_profiles_installationId_name_key" ON public.ardent_profiles USING btree ("installationId", name);
|
|
2361
|
+
|
|
2362
|
+
CREATE INDEX "ardent_profiles_running_observedAt_idx" ON public.ardent_profiles USING btree (running, "observedAt");
|
|
2363
|
+
|
|
2364
|
+
CREATE UNIQUE INDEX "ardent_scope_enrollments_decisionId_key" ON public.ardent_scope_enrollments USING btree ("decisionId");
|
|
2365
|
+
|
|
2366
|
+
CREATE UNIQUE INDEX command_resource_leases_active_resource ON public.command_resource_leases USING btree ("resourceKey") WHERE (state = ANY (ARRAY['reserved'::text, 'running'::text, 'unknown'::text]));
|
|
2367
|
+
|
|
2368
|
+
CREATE UNIQUE INDEX "command_resource_leases_commandId_key" ON public.command_resource_leases USING btree ("commandId");
|
|
2369
|
+
|
|
2370
|
+
CREATE INDEX "command_resource_leases_nodeId_state_idx" ON public.command_resource_leases USING btree ("nodeId", state);
|
|
2371
|
+
|
|
2372
|
+
CREATE INDEX "command_resource_leases_resourceKey_state_idx" ON public.command_resource_leases USING btree ("resourceKey", state);
|
|
2373
|
+
|
|
2374
|
+
CREATE UNIQUE INDEX "command_results_commandId_key" ON public.command_results USING btree ("commandId");
|
|
2375
|
+
|
|
2376
|
+
CREATE INDEX "cron_job_executions_cronJobId_startedAt_idx" ON public.cron_job_executions USING btree ("cronJobId", "startedAt");
|
|
2377
|
+
|
|
2378
|
+
CREATE UNIQUE INDEX "cron_jobs_nodeId_name_key" ON public.cron_jobs USING btree ("nodeId", name);
|
|
2379
|
+
|
|
2380
|
+
CREATE INDEX "deploy_jobs_createdBy_idx" ON public.deploy_jobs USING btree ("createdBy");
|
|
2381
|
+
|
|
2382
|
+
CREATE INDEX deploy_jobs_status_idx ON public.deploy_jobs USING btree (status);
|
|
2383
|
+
|
|
2384
|
+
CREATE INDEX "drift_scans_nodeId_idx" ON public.drift_scans USING btree ("nodeId");
|
|
2385
|
+
|
|
2386
|
+
CREATE INDEX drift_scans_status_idx ON public.drift_scans USING btree (status);
|
|
2387
|
+
|
|
2388
|
+
CREATE INDEX "engineering_metric_samples_applicationId_metric_observedAt_idx" ON public.engineering_metric_samples USING btree ("applicationId", metric, "observedAt");
|
|
2389
|
+
|
|
2390
|
+
CREATE UNIQUE INDEX "engineering_metric_samples_applicationId_metric_sourceKey_o_key" ON public.engineering_metric_samples USING btree ("applicationId", metric, "sourceKey", "observedAt");
|
|
2391
|
+
|
|
2392
|
+
CREATE INDEX "engineering_metric_samples_nodeId_metric_observedAt_idx" ON public.engineering_metric_samples USING btree ("nodeId", metric, "observedAt");
|
|
2393
|
+
|
|
2394
|
+
CREATE UNIQUE INDEX "engineering_recovery_exercises_runnerNonce_key" ON public.engineering_recovery_exercises USING btree ("runnerNonce");
|
|
2395
|
+
|
|
2396
|
+
CREATE UNIQUE INDEX "engineering_recovery_exercises_runnerReceiptSha256_key" ON public.engineering_recovery_exercises USING btree ("runnerReceiptSha256");
|
|
2397
|
+
|
|
2398
|
+
CREATE INDEX "engineering_recovery_exercises_scenario_createdAt_idx" ON public.engineering_recovery_exercises USING btree (scenario, "createdAt");
|
|
2399
|
+
|
|
2400
|
+
CREATE INDEX "engineering_recovery_exercises_targetId_createdAt_idx" ON public.engineering_recovery_exercises USING btree ("targetId", "createdAt");
|
|
2401
|
+
|
|
2402
|
+
CREATE INDEX execution_runs_status_idx ON public.execution_runs USING btree (status);
|
|
2403
|
+
|
|
2404
|
+
CREATE INDEX "file_patch_tasks_nodeId_status_idx" ON public.file_patch_tasks USING btree ("nodeId", status);
|
|
2405
|
+
|
|
2406
|
+
CREATE INDEX "gpu_snapshots_nodeId_sampledAt_idx" ON public.gpu_snapshots USING btree ("nodeId", "sampledAt");
|
|
2407
|
+
|
|
2408
|
+
CREATE UNIQUE INDEX "gpu_snapshots_nodeId_sampledAt_key" ON public.gpu_snapshots USING btree ("nodeId", "sampledAt");
|
|
2409
|
+
|
|
2410
|
+
CREATE INDEX "health_snapshots_nodeId_timestamp_idx" ON public.health_snapshots USING btree ("nodeId", "timestamp");
|
|
2411
|
+
|
|
2412
|
+
CREATE UNIQUE INDEX "hermes_core_rollout_hosts_rolloutId_hostname_key" ON public.hermes_core_rollout_hosts USING btree ("rolloutId", hostname);
|
|
2413
|
+
|
|
2414
|
+
CREATE INDEX "hermes_core_rollout_hosts_rolloutId_stage_status_idx" ON public.hermes_core_rollout_hosts USING btree ("rolloutId", stage, status);
|
|
2415
|
+
|
|
2416
|
+
CREATE INDEX "hermes_core_rollouts_status_createdAt_idx" ON public.hermes_core_rollouts USING btree (status, "createdAt");
|
|
2417
|
+
|
|
2418
|
+
CREATE INDEX "hermes_credential_pool_attachments_installationId_idx" ON public.hermes_credential_pool_attachments USING btree ("installationId");
|
|
2419
|
+
|
|
2420
|
+
CREATE UNIQUE INDEX "hermes_credential_pool_attachments_poolId_installationId_pr_key" ON public.hermes_credential_pool_attachments USING btree ("poolId", "installationId", "profileId");
|
|
2421
|
+
|
|
2422
|
+
CREATE UNIQUE INDEX hermes_credential_pools_name_key ON public.hermes_credential_pools USING btree (name);
|
|
2423
|
+
|
|
2424
|
+
CREATE INDEX "hermes_cron_jobs_installationId_idx" ON public.hermes_cron_jobs USING btree ("installationId");
|
|
2425
|
+
|
|
2426
|
+
CREATE UNIQUE INDEX "hermes_cron_jobs_installationId_profileId_name_key" ON public.hermes_cron_jobs USING btree ("installationId", "profileId", name);
|
|
2427
|
+
|
|
2428
|
+
CREATE INDEX hermes_hooks_event_idx ON public.hermes_hooks USING btree (event);
|
|
2429
|
+
|
|
2430
|
+
CREATE INDEX "hermes_hooks_installationId_idx" ON public.hermes_hooks USING btree ("installationId");
|
|
2431
|
+
|
|
2432
|
+
CREATE UNIQUE INDEX "hermes_installations_hostname_hermesHome_key" ON public.hermes_installations USING btree (hostname, "hermesHome");
|
|
2433
|
+
|
|
2434
|
+
CREATE INDEX hermes_installations_hostname_idx ON public.hermes_installations USING btree (hostname);
|
|
2435
|
+
|
|
2436
|
+
CREATE INDEX "hermes_installations_nodeId_idx" ON public.hermes_installations USING btree ("nodeId");
|
|
2437
|
+
|
|
2438
|
+
CREATE INDEX hermes_installations_status_idx ON public.hermes_installations USING btree (status);
|
|
2439
|
+
|
|
2440
|
+
CREATE INDEX "hermes_mcp_server_attachments_installationId_idx" ON public.hermes_mcp_server_attachments USING btree ("installationId");
|
|
2441
|
+
|
|
2442
|
+
CREATE UNIQUE INDEX "hermes_mcp_server_attachments_serverId_installationId_profi_key" ON public.hermes_mcp_server_attachments USING btree ("serverId", "installationId", "profileId");
|
|
2443
|
+
|
|
2444
|
+
CREATE UNIQUE INDEX hermes_mcp_servers_name_key ON public.hermes_mcp_servers USING btree (name);
|
|
2445
|
+
|
|
2446
|
+
CREATE INDEX "hermes_messaging_bindings_installationId_idx" ON public.hermes_messaging_bindings USING btree ("installationId");
|
|
2447
|
+
|
|
2448
|
+
CREATE UNIQUE INDEX "hermes_messaging_bindings_installationId_profileId_platform_key" ON public.hermes_messaging_bindings USING btree ("installationId", "profileId", platform);
|
|
2449
|
+
|
|
2450
|
+
CREATE INDEX "hermes_operation_jobs_createdBy_idx" ON public.hermes_operation_jobs USING btree ("createdBy");
|
|
2451
|
+
|
|
2452
|
+
CREATE INDEX "hermes_operation_jobs_installationId_idx" ON public.hermes_operation_jobs USING btree ("installationId");
|
|
2453
|
+
|
|
2454
|
+
CREATE INDEX "hermes_operation_jobs_profileId_idx" ON public.hermes_operation_jobs USING btree ("profileId");
|
|
2455
|
+
|
|
2456
|
+
CREATE INDEX "hermes_operation_jobs_startedAt_idx" ON public.hermes_operation_jobs USING btree ("startedAt");
|
|
2457
|
+
|
|
2458
|
+
CREATE INDEX hermes_operation_jobs_status_idx ON public.hermes_operation_jobs USING btree (status);
|
|
2459
|
+
|
|
2460
|
+
CREATE INDEX hermes_operation_jobs_type_idx ON public.hermes_operation_jobs USING btree (type);
|
|
2461
|
+
|
|
2462
|
+
CREATE INDEX "hermes_plugin_installs_installationId_idx" ON public.hermes_plugin_installs USING btree ("installationId");
|
|
2463
|
+
|
|
2464
|
+
CREATE UNIQUE INDEX "hermes_plugin_installs_installationId_profileId_pluginSlug_key" ON public.hermes_plugin_installs USING btree ("installationId", "profileId", "pluginSlug");
|
|
2465
|
+
|
|
2466
|
+
CREATE INDEX "hermes_plugin_installs_pluginType_idx" ON public.hermes_plugin_installs USING btree ("pluginType");
|
|
2467
|
+
|
|
2468
|
+
CREATE INDEX "hermes_profiles_gatewayStatus_idx" ON public.hermes_profiles USING btree ("gatewayStatus");
|
|
2469
|
+
|
|
2470
|
+
CREATE INDEX "hermes_profiles_installationId_idx" ON public.hermes_profiles USING btree ("installationId");
|
|
2471
|
+
|
|
2472
|
+
CREATE UNIQUE INDEX "hermes_profiles_installationId_name_key" ON public.hermes_profiles USING btree ("installationId", name);
|
|
2473
|
+
|
|
2474
|
+
CREATE INDEX "hermes_provider_configs_installationId_idx" ON public.hermes_provider_configs USING btree ("installationId");
|
|
2475
|
+
|
|
2476
|
+
CREATE UNIQUE INDEX "hermes_provider_configs_installationId_profileId_key" ON public.hermes_provider_configs USING btree ("installationId", "profileId");
|
|
2477
|
+
|
|
2478
|
+
CREATE INDEX "hermes_registry_clients_installationId_idx" ON public.hermes_registry_clients USING btree ("installationId");
|
|
2479
|
+
|
|
2480
|
+
CREATE UNIQUE INDEX "hermes_registry_clients_nodeId_installationId_key" ON public.hermes_registry_clients USING btree ("nodeId", "installationId");
|
|
2481
|
+
|
|
2482
|
+
CREATE UNIQUE INDEX "hermes_registry_clients_tokenSha256_key" ON public.hermes_registry_clients USING btree ("tokenSha256");
|
|
2483
|
+
|
|
2484
|
+
CREATE UNIQUE INDEX "hermes_registry_inventory_installationId_profileId_kind_slu_key" ON public.hermes_registry_inventory USING btree ("installationId", "profileId", kind, slug);
|
|
2485
|
+
|
|
2486
|
+
CREATE INDEX "hermes_registry_inventory_sourceKind_status_idx" ON public.hermes_registry_inventory USING btree ("sourceKind", status);
|
|
2487
|
+
|
|
2488
|
+
CREATE INDEX "hermes_registry_receipts_installationId_kind_slug_createdAt_idx" ON public.hermes_registry_receipts USING btree ("installationId", kind, slug, "createdAt");
|
|
2489
|
+
|
|
2490
|
+
CREATE UNIQUE INDEX hermes_registry_revisions_kind_slug_revision_key ON public.hermes_registry_revisions USING btree (kind, slug, revision);
|
|
2491
|
+
|
|
2492
|
+
CREATE INDEX hermes_registry_revisions_kind_slug_status_idx ON public.hermes_registry_revisions USING btree (kind, slug, status);
|
|
2493
|
+
|
|
2494
|
+
CREATE INDEX "hermes_registry_targets_installationId_enabled_idx" ON public.hermes_registry_targets USING btree ("installationId", enabled);
|
|
2495
|
+
|
|
2496
|
+
CREATE UNIQUE INDEX "hermes_registry_targets_kind_slug_installationId_profileId_key" ON public.hermes_registry_targets USING btree (kind, slug, "installationId", "profileId");
|
|
2497
|
+
|
|
2498
|
+
CREATE INDEX "hermes_role_applications_installationId_idx" ON public.hermes_role_applications USING btree ("installationId");
|
|
2499
|
+
|
|
2500
|
+
CREATE INDEX "hermes_role_applications_profileId_idx" ON public.hermes_role_applications USING btree ("profileId");
|
|
2501
|
+
|
|
2502
|
+
CREATE UNIQUE INDEX "hermes_role_applications_roleId_installationId_profileId_key" ON public.hermes_role_applications USING btree ("roleId", "installationId", "profileId");
|
|
2503
|
+
|
|
2504
|
+
CREATE UNIQUE INDEX hermes_roles_name_key ON public.hermes_roles USING btree (name);
|
|
2505
|
+
|
|
2506
|
+
CREATE INDEX "hermes_skill_assignments_installationId_idx" ON public.hermes_skill_assignments USING btree ("installationId");
|
|
2507
|
+
|
|
2508
|
+
CREATE UNIQUE INDEX "hermes_skill_assignments_installationId_profileId_skillSlug_key" ON public.hermes_skill_assignments USING btree ("installationId", "profileId", "skillSlug");
|
|
2509
|
+
|
|
2510
|
+
CREATE INDEX "hermes_skill_assignments_profileId_idx" ON public.hermes_skill_assignments USING btree ("profileId");
|
|
2511
|
+
|
|
2512
|
+
CREATE INDEX hermes_skill_assignments_status_idx ON public.hermes_skill_assignments USING btree (status);
|
|
2513
|
+
|
|
2514
|
+
CREATE INDEX "hermes_toolset_policies_installationId_idx" ON public.hermes_toolset_policies USING btree ("installationId");
|
|
2515
|
+
|
|
2516
|
+
CREATE UNIQUE INDEX "hermes_toolset_policies_installationId_profileId_toolset_key" ON public.hermes_toolset_policies USING btree ("installationId", "profileId", toolset);
|
|
2517
|
+
|
|
2518
|
+
CREATE INDEX "hermes_toolset_policies_profileId_idx" ON public.hermes_toolset_policies USING btree ("profileId");
|
|
2519
|
+
|
|
2520
|
+
CREATE INDEX "incident_lessons_incidentId_expiresAt_idx" ON public.incident_lessons USING btree ("incidentId", "expiresAt");
|
|
2521
|
+
|
|
2522
|
+
CREATE UNIQUE INDEX library_categories_name_key ON public.library_categories USING btree (name);
|
|
2523
|
+
|
|
2524
|
+
CREATE INDEX "library_files_categoryId_idx" ON public.library_files USING btree ("categoryId");
|
|
2525
|
+
|
|
2526
|
+
CREATE INDEX library_files_name_idx ON public.library_files USING btree (name);
|
|
2527
|
+
|
|
2528
|
+
CREATE INDEX log_entries_level_idx ON public.log_entries USING btree (level);
|
|
2529
|
+
|
|
2530
|
+
CREATE INDEX "log_entries_nodeId_timestamp_idx" ON public.log_entries USING btree ("nodeId", "timestamp");
|
|
2531
|
+
|
|
2532
|
+
CREATE INDEX log_entries_source_idx ON public.log_entries USING btree (source);
|
|
2533
|
+
|
|
2534
|
+
CREATE INDEX magnus_release_canaries_epoch_idx ON public.magnus_release_canaries USING btree (epoch);
|
|
2535
|
+
|
|
2536
|
+
CREATE INDEX "maintenance_windows_startsAt_endsAt_idx" ON public.maintenance_windows USING btree ("startsAt", "endsAt");
|
|
2537
|
+
|
|
2538
|
+
CREATE UNIQUE INDEX "managed_cron_definitions_nodeId_jobId_key" ON public.managed_cron_definitions USING btree ("nodeId", "jobId");
|
|
2539
|
+
|
|
2540
|
+
CREATE UNIQUE INDEX "managed_cron_occurrences_commandId_key" ON public.managed_cron_occurrences USING btree ("commandId");
|
|
2541
|
+
|
|
2542
|
+
CREATE INDEX "managed_cron_occurrences_nodeId_state_idx" ON public.managed_cron_occurrences USING btree ("nodeId", state);
|
|
2543
|
+
|
|
2544
|
+
CREATE INDEX "nodes_ipAddress_idx" ON public.nodes USING btree ("ipAddress");
|
|
2545
|
+
|
|
2546
|
+
CREATE INDEX "nodes_lastHeartbeatAt_idx" ON public.nodes USING btree ("lastHeartbeatAt");
|
|
2547
|
+
|
|
2548
|
+
CREATE UNIQUE INDEX nodes_name_key ON public.nodes USING btree (name);
|
|
2549
|
+
|
|
2550
|
+
CREATE INDEX "nodes_roleId_idx" ON public.nodes USING btree ("roleId");
|
|
2551
|
+
|
|
2552
|
+
CREATE INDEX nodes_status_idx ON public.nodes USING btree (status);
|
|
2553
|
+
|
|
2554
|
+
CREATE UNIQUE INDEX nodes_token_key ON public.nodes USING btree (token);
|
|
2555
|
+
|
|
2556
|
+
CREATE UNIQUE INDEX "notification_preferences_userId_channel_category_key" ON public.notification_preferences USING btree ("userId", channel, category);
|
|
2557
|
+
|
|
2558
|
+
CREATE INDEX "notification_preferences_userId_idx" ON public.notification_preferences USING btree ("userId");
|
|
2559
|
+
|
|
2560
|
+
CREATE INDEX "notifications_isRead_createdAt_idx" ON public.notifications USING btree ("isRead", "createdAt");
|
|
2561
|
+
|
|
2562
|
+
CREATE INDEX "notifications_nodeId_createdAt_idx" ON public.notifications USING btree ("nodeId", "createdAt");
|
|
2563
|
+
|
|
2564
|
+
CREATE INDEX "notifications_type_createdAt_idx" ON public.notifications USING btree (type, "createdAt");
|
|
2565
|
+
|
|
2566
|
+
CREATE INDEX "notifications_type_nodeId_sourceRef_createdAt_idx" ON public.notifications USING btree (type, "nodeId", "sourceRef", "createdAt");
|
|
2567
|
+
|
|
2568
|
+
CREATE INDEX "remediation_executions_nodeId_triggeredAt_idx" ON public.remediation_executions USING btree ("nodeId", "triggeredAt");
|
|
2569
|
+
|
|
2570
|
+
CREATE INDEX "remediation_executions_ruleId_triggeredAt_idx" ON public.remediation_executions USING btree ("ruleId", "triggeredAt");
|
|
2571
|
+
|
|
2572
|
+
CREATE INDEX remediation_executions_status_idx ON public.remediation_executions USING btree (status);
|
|
2573
|
+
|
|
2574
|
+
CREATE INDEX remediation_rules_enabled_metric_idx ON public.remediation_rules USING btree (enabled, metric);
|
|
2575
|
+
|
|
2576
|
+
CREATE UNIQUE INDEX remediation_rules_name_key ON public.remediation_rules USING btree (name);
|
|
2577
|
+
|
|
2578
|
+
CREATE INDEX "remote_commands_correlationId_idx" ON public.remote_commands USING btree ("correlationId");
|
|
2579
|
+
|
|
2580
|
+
CREATE INDEX "remote_commands_idempotencyKey_idx" ON public.remote_commands USING btree ("idempotencyKey");
|
|
2581
|
+
|
|
2582
|
+
CREATE UNIQUE INDEX "remote_commands_idempotencyKey_key" ON public.remote_commands USING btree ("idempotencyKey");
|
|
2583
|
+
|
|
2584
|
+
CREATE INDEX "remote_commands_nodeId_status_idx" ON public.remote_commands USING btree ("nodeId", status);
|
|
2585
|
+
|
|
2586
|
+
CREATE INDEX "resource_participant_work_nodeId_participant_state_idx" ON public.resource_participant_work USING btree ("nodeId", participant, state);
|
|
2587
|
+
|
|
2588
|
+
CREATE UNIQUE INDEX "resource_participant_work_nodeSessionReceiptSha256_key" ON public.resource_participant_work USING btree ("nodeSessionReceiptSha256");
|
|
2589
|
+
|
|
2590
|
+
CREATE UNIQUE INDEX "resource_participant_work_reconciliationDecisionId_key" ON public.resource_participant_work USING btree ("reconciliationDecisionId");
|
|
2591
|
+
|
|
2592
|
+
CREATE INDEX "role_applications_nodeId_idx" ON public.role_applications USING btree ("nodeId");
|
|
2593
|
+
|
|
2594
|
+
CREATE INDEX "role_applications_roleId_idx" ON public.role_applications USING btree ("roleId");
|
|
2595
|
+
|
|
2596
|
+
CREATE INDEX role_applications_status_idx ON public.role_applications USING btree (status);
|
|
2597
|
+
|
|
2598
|
+
CREATE UNIQUE INDEX roles_name_key ON public.roles USING btree (name);
|
|
2599
|
+
|
|
2600
|
+
CREATE UNIQUE INDEX "rollout_targets_commandId_key" ON public.rollout_targets USING btree ("commandId");
|
|
2601
|
+
|
|
2602
|
+
CREATE UNIQUE INDEX "rollout_targets_rolloutId_nodeId_key" ON public.rollout_targets USING btree ("rolloutId", "nodeId");
|
|
2603
|
+
|
|
2604
|
+
CREATE INDEX "security_export_outbox_deliveredAt_nextAttemptAt_idx" ON public.security_export_outbox USING btree ("deliveredAt", "nextAttemptAt");
|
|
2605
|
+
|
|
2606
|
+
CREATE UNIQUE INDEX "security_fusion_action_approvals_actionId_key" ON public.security_fusion_action_approvals USING btree ("actionId");
|
|
2607
|
+
|
|
2608
|
+
CREATE INDEX "security_fusion_action_approvals_expiresAt_idx" ON public.security_fusion_action_approvals USING btree ("expiresAt");
|
|
2609
|
+
|
|
2610
|
+
CREATE INDEX "security_fusion_actions_caseId_createdAt_idx" ON public.security_fusion_actions USING btree ("caseId", "createdAt");
|
|
2611
|
+
|
|
2612
|
+
CREATE INDEX "security_fusion_actions_status_approvalExpiresAt_idx" ON public.security_fusion_actions USING btree (status, "approvalExpiresAt");
|
|
2613
|
+
|
|
2614
|
+
CREATE INDEX "security_fusion_case_activity_caseId_createdAt_idx" ON public.security_fusion_case_activity USING btree ("caseId", "createdAt");
|
|
2615
|
+
|
|
2616
|
+
CREATE UNIQUE INDEX "security_fusion_case_entities_caseId_entityId_key" ON public.security_fusion_case_entities USING btree ("caseId", "entityId");
|
|
2617
|
+
|
|
2618
|
+
CREATE INDEX "security_fusion_case_entities_entityId_idx" ON public.security_fusion_case_entities USING btree ("entityId");
|
|
2619
|
+
|
|
2620
|
+
CREATE UNIQUE INDEX "security_fusion_case_events_caseId_eventId_key" ON public.security_fusion_case_events USING btree ("caseId", "eventId");
|
|
2621
|
+
|
|
2622
|
+
CREATE INDEX "security_fusion_case_events_eventId_idx" ON public.security_fusion_case_events USING btree ("eventId");
|
|
2623
|
+
|
|
2624
|
+
CREATE UNIQUE INDEX "security_fusion_case_relationships_fromCaseId_toCaseId_kind_key" ON public.security_fusion_case_relationships USING btree ("fromCaseId", "toCaseId", kind);
|
|
2625
|
+
|
|
2626
|
+
CREATE INDEX "security_fusion_case_relationships_toCaseId_idx" ON public.security_fusion_case_relationships USING btree ("toCaseId");
|
|
2627
|
+
|
|
2628
|
+
CREATE INDEX "security_fusion_cases_archivedAt_lastSeenAt_idx" ON public.security_fusion_cases USING btree ("archivedAt", "lastSeenAt");
|
|
2629
|
+
|
|
2630
|
+
CREATE UNIQUE INDEX security_fusion_cases_fingerprint_key ON public.security_fusion_cases USING btree (fingerprint);
|
|
2631
|
+
|
|
2632
|
+
CREATE INDEX "security_fusion_cases_status_severity_lastSeenAt_idx" ON public.security_fusion_cases USING btree (status, severity, "lastSeenAt");
|
|
2633
|
+
|
|
2634
|
+
CREATE INDEX "security_fusion_collectors_status_lastReceiptAt_idx" ON public.security_fusion_collectors USING btree (status, "lastReceiptAt");
|
|
2635
|
+
|
|
2636
|
+
CREATE UNIQUE INDEX "security_fusion_command_outbox_actionId_operation_key" ON public.security_fusion_command_outbox USING btree ("actionId", operation);
|
|
2637
|
+
|
|
2638
|
+
CREATE UNIQUE INDEX "security_fusion_command_outbox_remoteCommandId_key" ON public.security_fusion_command_outbox USING btree ("remoteCommandId");
|
|
2639
|
+
|
|
2640
|
+
CREATE INDEX "security_fusion_command_outbox_status_nextAttemptAt_idx" ON public.security_fusion_command_outbox USING btree (status, "nextAttemptAt");
|
|
2641
|
+
|
|
2642
|
+
CREATE UNIQUE INDEX "security_fusion_deletion_receipts_chainSequence_key" ON public.security_fusion_deletion_receipts USING btree ("chainSequence");
|
|
2643
|
+
|
|
2644
|
+
CREATE INDEX "security_fusion_deletion_receipts_deletedAt_idx" ON public.security_fusion_deletion_receipts USING btree ("deletedAt");
|
|
2645
|
+
|
|
2646
|
+
CREATE UNIQUE INDEX "security_fusion_deletion_receipts_receiptSha256_key" ON public.security_fusion_deletion_receipts USING btree ("receiptSha256");
|
|
2647
|
+
|
|
2648
|
+
CREATE INDEX "security_fusion_deletion_receipts_resourceType_deletedAt_idx" ON public.security_fusion_deletion_receipts USING btree ("resourceType", "deletedAt");
|
|
2649
|
+
|
|
2650
|
+
CREATE INDEX "security_fusion_deliveries_caseId_createdAt_idx" ON public.security_fusion_deliveries USING btree ("caseId", "createdAt");
|
|
2651
|
+
|
|
2652
|
+
CREATE UNIQUE INDEX "security_fusion_deliveries_revisionKey_key" ON public.security_fusion_deliveries USING btree ("revisionKey");
|
|
2653
|
+
|
|
2654
|
+
CREATE INDEX "security_fusion_entities_lastSeenAt_idx" ON public.security_fusion_entities USING btree ("lastSeenAt");
|
|
2655
|
+
|
|
2656
|
+
CREATE UNIQUE INDEX security_fusion_entities_type_canonical_key ON public.security_fusion_entities USING btree (type, canonical);
|
|
2657
|
+
|
|
2658
|
+
CREATE INDEX "security_fusion_entity_aliases_entityId_idx" ON public.security_fusion_entity_aliases USING btree ("entityId");
|
|
2659
|
+
|
|
2660
|
+
CREATE UNIQUE INDEX security_fusion_entity_aliases_source_canonical_key ON public.security_fusion_entity_aliases USING btree (source, canonical);
|
|
2661
|
+
|
|
2662
|
+
CREATE INDEX "security_fusion_event_entities_entityId_idx" ON public.security_fusion_event_entities USING btree ("entityId");
|
|
2663
|
+
|
|
2664
|
+
CREATE UNIQUE INDEX "security_fusion_event_entities_eventId_entityId_key" ON public.security_fusion_event_entities USING btree ("eventId", "entityId");
|
|
2665
|
+
|
|
2666
|
+
CREATE UNIQUE INDEX "security_fusion_events_eventId_key" ON public.security_fusion_events USING btree ("eventId");
|
|
2667
|
+
|
|
2668
|
+
CREATE INDEX "security_fusion_events_kind_observedAt_idx" ON public.security_fusion_events USING btree (kind, "observedAt");
|
|
2669
|
+
|
|
2670
|
+
CREATE INDEX "security_fusion_events_observedAt_idx" ON public.security_fusion_events USING btree ("observedAt");
|
|
2671
|
+
|
|
2672
|
+
CREATE INDEX "security_fusion_events_severity_observedAt_idx" ON public.security_fusion_events USING btree (severity, "observedAt");
|
|
2673
|
+
|
|
2674
|
+
CREATE INDEX "security_fusion_events_source_observedAt_idx" ON public.security_fusion_events USING btree (source, "observedAt");
|
|
2675
|
+
|
|
2676
|
+
CREATE UNIQUE INDEX "security_fusion_events_source_sourceEventId_key" ON public.security_fusion_events USING btree (source, "sourceEventId");
|
|
2677
|
+
|
|
2678
|
+
CREATE INDEX "security_fusion_evidence_caseId_preservedAt_idx" ON public.security_fusion_evidence USING btree ("caseId", "preservedAt");
|
|
2679
|
+
|
|
2680
|
+
CREATE INDEX security_fusion_evidence_sha256_idx ON public.security_fusion_evidence USING btree (sha256);
|
|
2681
|
+
|
|
2682
|
+
CREATE INDEX "security_fusion_investigations_caseId_createdAt_idx" ON public.security_fusion_investigations USING btree ("caseId", "createdAt");
|
|
2683
|
+
|
|
2684
|
+
CREATE UNIQUE INDEX "security_fusion_investigations_caseId_revision_key" ON public.security_fusion_investigations USING btree ("caseId", revision);
|
|
2685
|
+
|
|
2686
|
+
CREATE INDEX "security_fusion_nonces_expiresAt_idx" ON public.security_fusion_nonces USING btree ("expiresAt");
|
|
2687
|
+
|
|
2688
|
+
CREATE INDEX security_fusion_rule_versions_enabled_idx ON public.security_fusion_rule_versions USING btree (enabled);
|
|
2689
|
+
|
|
2690
|
+
CREATE UNIQUE INDEX "security_fusion_rule_versions_ruleId_version_key" ON public.security_fusion_rule_versions USING btree ("ruleId", version);
|
|
2691
|
+
|
|
2692
|
+
CREATE UNIQUE INDEX security_fusion_source_state_source_key ON public.security_fusion_source_state USING btree (source);
|
|
2693
|
+
|
|
2694
|
+
CREATE UNIQUE INDEX shared_resource_lease_resources_active_resource ON public.shared_resource_lease_resources USING btree ("resourceKey") WHERE (state = ANY (ARRAY['reserved'::text, 'running'::text, 'unknown'::text]));
|
|
2695
|
+
|
|
2696
|
+
CREATE UNIQUE INDEX "shared_resource_lease_resources_resourceKey_fenceGeneration_key" ON public.shared_resource_lease_resources USING btree ("resourceKey", "fenceGeneration");
|
|
2697
|
+
|
|
2698
|
+
CREATE INDEX "shared_resource_lease_resources_resourceKey_state_idx" ON public.shared_resource_lease_resources USING btree ("resourceKey", state);
|
|
2699
|
+
|
|
2700
|
+
CREATE INDEX "shared_resource_leases_missionRootId_missionRevision_idx" ON public.shared_resource_leases USING btree ("missionRootId", "missionRevision");
|
|
2701
|
+
|
|
2702
|
+
CREATE UNIQUE INDEX "shared_resource_leases_operationId_key" ON public.shared_resource_leases USING btree ("operationId");
|
|
2703
|
+
|
|
2704
|
+
CREATE UNIQUE INDEX "shared_resource_leases_reconciliationDecisionId_key" ON public.shared_resource_leases USING btree ("reconciliationDecisionId");
|
|
2705
|
+
|
|
2706
|
+
CREATE UNIQUE INDEX "shared_resource_leases_settlementRecordSha256_key" ON public.shared_resource_leases USING btree ("settlementRecordSha256");
|
|
2707
|
+
|
|
2708
|
+
CREATE INDEX "shared_resource_leases_taskId_state_idx" ON public.shared_resource_leases USING btree ("taskId", state);
|
|
2709
|
+
|
|
2710
|
+
CREATE INDEX "skill_installations_registryEntryId_idx" ON public.skill_installations USING btree ("registryEntryId");
|
|
2711
|
+
|
|
2712
|
+
CREATE UNIQUE INDEX "skill_installations_skillName_nodeId_key" ON public.skill_installations USING btree ("skillName", "nodeId");
|
|
2713
|
+
|
|
2714
|
+
CREATE UNIQUE INDEX "skill_installations_workflowCommandId_key" ON public.skill_installations USING btree ("workflowCommandId");
|
|
2715
|
+
|
|
2716
|
+
CREATE UNIQUE INDEX "skill_installations_workflowReceiptSha256_key" ON public.skill_installations USING btree ("workflowReceiptSha256");
|
|
2717
|
+
|
|
2718
|
+
CREATE UNIQUE INDEX skill_registry_entries_slug_key ON public.skill_registry_entries USING btree (slug);
|
|
2719
|
+
|
|
2720
|
+
CREATE INDEX skill_registry_entries_source_idx ON public.skill_registry_entries USING btree (source);
|
|
2721
|
+
|
|
2722
|
+
CREATE INDEX skill_registry_entries_status_idx ON public.skill_registry_entries USING btree (status);
|
|
2723
|
+
|
|
2724
|
+
CREATE UNIQUE INDEX "skill_tags_skillId_tag_key" ON public.skill_tags USING btree ("skillId", tag);
|
|
2725
|
+
|
|
2726
|
+
CREATE INDEX "skill_versions_skillId_createdAt_idx" ON public.skill_versions USING btree ("skillId", "createdAt");
|
|
2727
|
+
|
|
2728
|
+
CREATE UNIQUE INDEX "skill_versions_skillId_version_key" ON public.skill_versions USING btree ("skillId", version);
|
|
2729
|
+
|
|
2730
|
+
CREATE UNIQUE INDEX "team_approval_decisions_executionId_key" ON public.team_approval_decisions USING btree ("executionId");
|
|
2731
|
+
|
|
2732
|
+
CREATE UNIQUE INDEX "team_approval_decisions_proposalId_key" ON public.team_approval_decisions USING btree ("proposalId");
|
|
2733
|
+
|
|
2734
|
+
CREATE UNIQUE INDEX users_email_key ON public.users USING btree (email);
|
|
2735
|
+
|
|
2736
|
+
CREATE INDEX "webhook_deliveries_endpointId_createdAt_idx" ON public.webhook_deliveries USING btree ("endpointId", "createdAt");
|
|
2737
|
+
|
|
2738
|
+
CREATE INDEX webhook_deliveries_status_idx ON public.webhook_deliveries USING btree (status);
|
|
2739
|
+
|
|
2740
|
+
CREATE INDEX webhook_endpoints_active_idx ON public.webhook_endpoints USING btree (active);
|
|
2741
|
+
|
|
2742
|
+
CREATE TRIGGER command_resource_leases_authority_immutable BEFORE UPDATE ON public.command_resource_leases FOR EACH ROW EXECUTE FUNCTION public.magnus_reject_command_resource_authority_update();
|
|
2743
|
+
|
|
2744
|
+
CREATE TRIGGER engineering_recovery_exercises_no_truncate BEFORE TRUNCATE ON public.engineering_recovery_exercises FOR EACH STATEMENT EXECUTE FUNCTION public.magnus_reject_recovery_exercise_update();
|
|
2745
|
+
|
|
2746
|
+
CREATE TRIGGER engineering_recovery_exercises_no_update BEFORE UPDATE ON public.engineering_recovery_exercises FOR EACH ROW EXECUTE FUNCTION public.magnus_reject_recovery_exercise_update();
|
|
2747
|
+
|
|
2748
|
+
CREATE TRIGGER managed_cron_clear_acknowledgement_on_disable BEFORE UPDATE OF enabled ON public.managed_cron_definitions FOR EACH ROW WHEN (((old.enabled IS TRUE) AND (new.enabled IS FALSE))) EXECUTE FUNCTION public.managed_cron_clear_acknowledgement_on_disable();
|
|
2749
|
+
|
|
2750
|
+
CREATE TRIGGER resource_participant_work_identity_immutable BEFORE UPDATE ON public.resource_participant_work FOR EACH ROW EXECUTE FUNCTION public.magnus_reject_resource_participant_identity_update();
|
|
2751
|
+
|
|
2752
|
+
CREATE CONSTRAINT TRIGGER shared_resource_claim_consistency AFTER INSERT OR DELETE OR UPDATE ON public.shared_resource_lease_resources DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE FUNCTION public.magnus_check_shared_resource_claim_consistency();
|
|
2753
|
+
|
|
2754
|
+
CREATE TRIGGER shared_resource_claim_delete_guard BEFORE DELETE ON public.shared_resource_lease_resources FOR EACH ROW EXECUTE FUNCTION public.magnus_reject_shared_resource_claim_delete();
|
|
2755
|
+
|
|
2756
|
+
CREATE TRIGGER shared_resource_claim_insert_guard BEFORE INSERT ON public.shared_resource_lease_resources FOR EACH ROW EXECUTE FUNCTION public.magnus_enforce_shared_resource_claim_insert();
|
|
2757
|
+
|
|
2758
|
+
CREATE TRIGGER shared_resource_claim_transition_guard BEFORE UPDATE ON public.shared_resource_lease_resources FOR EACH ROW EXECUTE FUNCTION public.magnus_enforce_shared_resource_claim_transition();
|
|
2759
|
+
|
|
2760
|
+
CREATE TRIGGER shared_resource_claim_truncate_guard BEFORE TRUNCATE ON public.shared_resource_lease_resources FOR EACH STATEMENT EXECUTE FUNCTION public.magnus_reject_shared_resource_claim_delete();
|
|
2761
|
+
|
|
2762
|
+
CREATE TRIGGER shared_resource_fence_delete_guard BEFORE DELETE ON public.shared_resource_fences FOR EACH ROW EXECUTE FUNCTION public.magnus_reject_shared_resource_fence_delete();
|
|
2763
|
+
|
|
2764
|
+
CREATE TRIGGER shared_resource_fence_generation_monotonic BEFORE UPDATE ON public.shared_resource_fences FOR EACH ROW EXECUTE FUNCTION public.magnus_enforce_shared_resource_fence_generation();
|
|
2765
|
+
|
|
2766
|
+
CREATE TRIGGER shared_resource_fence_insert_guard BEFORE INSERT ON public.shared_resource_fences FOR EACH ROW EXECUTE FUNCTION public.magnus_enforce_shared_resource_fence_insert();
|
|
2767
|
+
|
|
2768
|
+
CREATE TRIGGER shared_resource_fence_truncate_guard BEFORE TRUNCATE ON public.shared_resource_fences FOR EACH STATEMENT EXECUTE FUNCTION public.magnus_reject_shared_resource_fence_delete();
|
|
2769
|
+
|
|
2770
|
+
CREATE CONSTRAINT TRIGGER shared_resource_lease_consistency AFTER INSERT OR DELETE OR UPDATE ON public.shared_resource_leases DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE FUNCTION public.magnus_check_shared_resource_lease_consistency();
|
|
2771
|
+
|
|
2772
|
+
CREATE TRIGGER shared_resource_lease_insert_guard BEFORE INSERT ON public.shared_resource_leases FOR EACH ROW EXECUTE FUNCTION public.magnus_enforce_shared_resource_lease_insert();
|
|
2773
|
+
|
|
2774
|
+
CREATE TRIGGER shared_resource_lease_transition_guard BEFORE UPDATE ON public.shared_resource_leases FOR EACH ROW EXECUTE FUNCTION public.magnus_enforce_shared_resource_lease_transition();
|
|
2775
|
+
|
|
2776
|
+
ALTER TABLE ONLY public.agents
|
|
2777
|
+
ADD CONSTRAINT "agents_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2778
|
+
|
|
2779
|
+
ALTER TABLE ONLY public.ai_conversations
|
|
2780
|
+
ADD CONSTRAINT "ai_conversations_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES public.ai_conversations(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
|
2781
|
+
|
|
2782
|
+
ALTER TABLE ONLY public.ai_messages
|
|
2783
|
+
ADD CONSTRAINT "ai_messages_conversationId_fkey" FOREIGN KEY ("conversationId") REFERENCES public.ai_conversations(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2784
|
+
|
|
2785
|
+
ALTER TABLE ONLY public.alert_condition_states
|
|
2786
|
+
ADD CONSTRAINT "alert_condition_states_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2787
|
+
|
|
2788
|
+
ALTER TABLE ONLY public.alert_condition_states
|
|
2789
|
+
ADD CONSTRAINT "alert_condition_states_ruleId_fkey" FOREIGN KEY ("ruleId") REFERENCES public.alert_rules(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2790
|
+
|
|
2791
|
+
ALTER TABLE ONLY public.alert_violations
|
|
2792
|
+
ADD CONSTRAINT "alert_violations_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2793
|
+
|
|
2794
|
+
ALTER TABLE ONLY public.alert_violations
|
|
2795
|
+
ADD CONSTRAINT "alert_violations_ruleId_fkey" FOREIGN KEY ("ruleId") REFERENCES public.alert_rules(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2796
|
+
|
|
2797
|
+
ALTER TABLE ONLY public.anomaly_events
|
|
2798
|
+
ADD CONSTRAINT "anomaly_events_healthSnapshotId_fkey" FOREIGN KEY ("healthSnapshotId") REFERENCES public.health_snapshots(id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
|
2799
|
+
|
|
2800
|
+
ALTER TABLE ONLY public.anomaly_events
|
|
2801
|
+
ADD CONSTRAINT "anomaly_events_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2802
|
+
|
|
2803
|
+
ALTER TABLE ONLY public.ardent_installations
|
|
2804
|
+
ADD CONSTRAINT "ardent_installations_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2805
|
+
|
|
2806
|
+
ALTER TABLE ONLY public.ardent_profiles
|
|
2807
|
+
ADD CONSTRAINT "ardent_profiles_installationId_fkey" FOREIGN KEY ("installationId") REFERENCES public.ardent_installations(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2808
|
+
|
|
2809
|
+
ALTER TABLE ONLY public.ardent_scope_enrollments
|
|
2810
|
+
ADD CONSTRAINT "ardent_scope_enrollments_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
|
2811
|
+
|
|
2812
|
+
ALTER TABLE ONLY public.command_results
|
|
2813
|
+
ADD CONSTRAINT "command_results_commandId_fkey" FOREIGN KEY ("commandId") REFERENCES public.remote_commands(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2814
|
+
|
|
2815
|
+
ALTER TABLE ONLY public.council_admission_fences
|
|
2816
|
+
ADD CONSTRAINT "council_admission_fences_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
|
2817
|
+
|
|
2818
|
+
ALTER TABLE ONLY public.cron_job_executions
|
|
2819
|
+
ADD CONSTRAINT "cron_job_executions_cronJobId_fkey" FOREIGN KEY ("cronJobId") REFERENCES public.cron_jobs(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2820
|
+
|
|
2821
|
+
ALTER TABLE ONLY public.cron_job_executions
|
|
2822
|
+
ADD CONSTRAINT "cron_job_executions_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2823
|
+
|
|
2824
|
+
ALTER TABLE ONLY public.cron_jobs
|
|
2825
|
+
ADD CONSTRAINT "cron_jobs_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2826
|
+
|
|
2827
|
+
ALTER TABLE ONLY public.drift_scans
|
|
2828
|
+
ADD CONSTRAINT "drift_scans_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2829
|
+
|
|
2830
|
+
ALTER TABLE ONLY public.engineering_metric_samples
|
|
2831
|
+
ADD CONSTRAINT "engineering_metric_samples_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2832
|
+
|
|
2833
|
+
ALTER TABLE ONLY public.file_patch_tasks
|
|
2834
|
+
ADD CONSTRAINT "file_patch_tasks_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2835
|
+
|
|
2836
|
+
ALTER TABLE ONLY public.gpu_snapshots
|
|
2837
|
+
ADD CONSTRAINT "gpu_snapshots_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2838
|
+
|
|
2839
|
+
ALTER TABLE ONLY public.health_snapshots
|
|
2840
|
+
ADD CONSTRAINT "health_snapshots_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2841
|
+
|
|
2842
|
+
ALTER TABLE ONLY public.hermes_core_rollout_hosts
|
|
2843
|
+
ADD CONSTRAINT "hermes_core_rollout_hosts_rolloutId_fkey" FOREIGN KEY ("rolloutId") REFERENCES public.hermes_core_rollouts(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2844
|
+
|
|
2845
|
+
ALTER TABLE ONLY public.hermes_credential_pool_attachments
|
|
2846
|
+
ADD CONSTRAINT "hermes_credential_pool_attachments_poolId_fkey" FOREIGN KEY ("poolId") REFERENCES public.hermes_credential_pools(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2847
|
+
|
|
2848
|
+
ALTER TABLE ONLY public.hermes_installations
|
|
2849
|
+
ADD CONSTRAINT "hermes_installations_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2850
|
+
|
|
2851
|
+
ALTER TABLE ONLY public.hermes_mcp_server_attachments
|
|
2852
|
+
ADD CONSTRAINT "hermes_mcp_server_attachments_serverId_fkey" FOREIGN KEY ("serverId") REFERENCES public.hermes_mcp_servers(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2853
|
+
|
|
2854
|
+
ALTER TABLE ONLY public.hermes_operation_jobs
|
|
2855
|
+
ADD CONSTRAINT "hermes_operation_jobs_installationId_fkey" FOREIGN KEY ("installationId") REFERENCES public.hermes_installations(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
|
2856
|
+
|
|
2857
|
+
ALTER TABLE ONLY public.hermes_operation_jobs
|
|
2858
|
+
ADD CONSTRAINT "hermes_operation_jobs_profileId_fkey" FOREIGN KEY ("profileId") REFERENCES public.hermes_profiles(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
|
2859
|
+
|
|
2860
|
+
ALTER TABLE ONLY public.hermes_profiles
|
|
2861
|
+
ADD CONSTRAINT "hermes_profiles_installationId_fkey" FOREIGN KEY ("installationId") REFERENCES public.hermes_installations(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2862
|
+
|
|
2863
|
+
ALTER TABLE ONLY public.hermes_role_applications
|
|
2864
|
+
ADD CONSTRAINT "hermes_role_applications_roleId_fkey" FOREIGN KEY ("roleId") REFERENCES public.hermes_roles(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2865
|
+
|
|
2866
|
+
ALTER TABLE ONLY public.library_files
|
|
2867
|
+
ADD CONSTRAINT "library_files_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES public.library_categories(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
|
2868
|
+
|
|
2869
|
+
ALTER TABLE ONLY public.log_entries
|
|
2870
|
+
ADD CONSTRAINT "log_entries_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2871
|
+
|
|
2872
|
+
ALTER TABLE ONLY public.nodes
|
|
2873
|
+
ADD CONSTRAINT "nodes_roleId_fkey" FOREIGN KEY ("roleId") REFERENCES public.roles(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
|
2874
|
+
|
|
2875
|
+
ALTER TABLE ONLY public.notifications
|
|
2876
|
+
ADD CONSTRAINT "notifications_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
|
2877
|
+
|
|
2878
|
+
ALTER TABLE ONLY public.remediation_executions
|
|
2879
|
+
ADD CONSTRAINT "remediation_executions_ruleId_fkey" FOREIGN KEY ("ruleId") REFERENCES public.remediation_rules(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2880
|
+
|
|
2881
|
+
ALTER TABLE ONLY public.remote_commands
|
|
2882
|
+
ADD CONSTRAINT "remote_commands_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2883
|
+
|
|
2884
|
+
ALTER TABLE ONLY public.resource_drain_participants
|
|
2885
|
+
ADD CONSTRAINT "resource_drain_participants_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.resource_enrollments("nodeId") ON UPDATE CASCADE ON DELETE RESTRICT;
|
|
2886
|
+
|
|
2887
|
+
ALTER TABLE ONLY public.resource_enrollments
|
|
2888
|
+
ADD CONSTRAINT "resource_enrollments_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
|
2889
|
+
|
|
2890
|
+
ALTER TABLE ONLY public.resource_participant_work
|
|
2891
|
+
ADD CONSTRAINT "resource_participant_work_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
|
2892
|
+
|
|
2893
|
+
ALTER TABLE ONLY public.role_applications
|
|
2894
|
+
ADD CONSTRAINT "role_applications_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2895
|
+
|
|
2896
|
+
ALTER TABLE ONLY public.role_applications
|
|
2897
|
+
ADD CONSTRAINT "role_applications_roleId_fkey" FOREIGN KEY ("roleId") REFERENCES public.roles(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2898
|
+
|
|
2899
|
+
ALTER TABLE ONLY public.rollout_targets
|
|
2900
|
+
ADD CONSTRAINT "rollout_targets_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2901
|
+
|
|
2902
|
+
ALTER TABLE ONLY public.rollout_targets
|
|
2903
|
+
ADD CONSTRAINT "rollout_targets_rolloutId_fkey" FOREIGN KEY ("rolloutId") REFERENCES public.execution_runs(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2904
|
+
|
|
2905
|
+
ALTER TABLE ONLY public.shared_resource_lease_resources
|
|
2906
|
+
ADD CONSTRAINT "shared_resource_lease_resources_leaseId_fkey" FOREIGN KEY ("leaseId") REFERENCES public.shared_resource_leases(id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
|
2907
|
+
|
|
2908
|
+
ALTER TABLE ONLY public.skill_installations
|
|
2909
|
+
ADD CONSTRAINT "skill_installations_nodeId_fkey" FOREIGN KEY ("nodeId") REFERENCES public.nodes(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2910
|
+
|
|
2911
|
+
ALTER TABLE ONLY public.skill_installations
|
|
2912
|
+
ADD CONSTRAINT "skill_installations_registryEntryId_fkey" FOREIGN KEY ("registryEntryId") REFERENCES public.skill_registry_entries(id) ON UPDATE CASCADE ON DELETE SET NULL;
|
|
2913
|
+
|
|
2914
|
+
ALTER TABLE ONLY public.skill_tags
|
|
2915
|
+
ADD CONSTRAINT "skill_tags_skillId_fkey" FOREIGN KEY ("skillId") REFERENCES public.skill_registry_entries(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2916
|
+
|
|
2917
|
+
ALTER TABLE ONLY public.skill_versions
|
|
2918
|
+
ADD CONSTRAINT "skill_versions_skillId_fkey" FOREIGN KEY ("skillId") REFERENCES public.skill_registry_entries(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2919
|
+
|
|
2920
|
+
ALTER TABLE ONLY public.webhook_deliveries
|
|
2921
|
+
ADD CONSTRAINT "webhook_deliveries_endpointId_fkey" FOREIGN KEY ("endpointId") REFERENCES public.webhook_endpoints(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
2922
|
+
|
|
2923
|
+
-- Base rows the server expects to exist.
|
|
2924
|
+
INSERT INTO public.security_fusion_receipt_chain_heads ("id", "headSha256", "chainSequence", "updatedAt")
|
|
2925
|
+
VALUES ('security-fusion', NULL, 0, CURRENT_TIMESTAMP)
|
|
2926
|
+
ON CONFLICT ("id") DO NOTHING;
|
|
2927
|
+
|
|
2928
|
+
INSERT INTO public.alert_rules (
|
|
2929
|
+
"id", "name", "metric", "operator", "threshold", "durationSeconds",
|
|
2930
|
+
"severity", "nodeFilter", "active", "cooldownMinutes", "createdBy", "createdAt", "updatedAt"
|
|
2931
|
+
) VALUES (
|
|
2932
|
+
'system-gpu-fan-100-8h', 'GPU fan saturated for 8 hours', 'gpu_fan', 'gte', 100, 28800,
|
|
2933
|
+
'critical', '*', true, 480, 'system', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
|
|
2934
|
+
)
|
|
2935
|
+
ON CONFLICT ("id") DO NOTHING;
|