Skip to content

Promote command-center operating models into Prisma safely #172

Description

@support371

Objective

Promote the reviewed command-center operating layer into prisma/schema.prisma without duplicating the existing Organization, Workspace, Connector, ApprovalRequest, ApprovalDecision, AnalyticsSnapshot, or AuditEvent foundations.

Reuse decisions

  • Organization + Workspace remain the tenant boundary.
  • WorkspaceMember + Role + Permission remain the authorization model.
  • Connector + ConnectorCredentialReference remain the integration identity and secret-reference model.
  • ApprovalRequest + ApprovalDecision remain the human-approval gate.
  • AuditEvent remains the immutable operating audit trail.
  • AnalyticsSnapshot remains the generic time-series metric store.

New operating models required

  • Subscription and plan lifecycle state.
  • UsageRecord for metered product usage.
  • SecurityAsset and SecurityIncident.
  • ComplianceFramework, ComplianceControl, ComplianceEvidence, ComplianceTask, and Risk.
  • GovernedAgent and GovernedAgentRun.
  • IntegrationHealth linked to Connector.

Acceptance criteria

  • Add the missing enums and models to prisma/schema.prisma.
  • Add explicit Workspace/Organization/Connector relations and tenant-safe indexes.
  • Keep secrets out of all new models; store only external secret references through ConnectorCredentialReference.
  • Generate a formal Prisma migration from schema diff.
  • Apply and rollback the migration on a disposable PostgreSQL database.
  • Run prisma validate, prisma generate, lint, typecheck, tests, and Next.js production build.
  • Confirm the command-center readiness repository changes from migration_required to installed only when all expected tables exist.
  • Obtain explicit owner approval before any production migration execution.

Prohibited in this issue

  • No production database migration.
  • No Stripe activation, prices, subscriptions, charges, or webhook activation.
  • No storage of API secrets, OAuth tokens, payment-card data, or bank credentials.
  • No destructive action or automatic approval.

Branch

feat/command-center-prisma-operating-models

Parent delivery

PR #163 and issue #164 delivered the authenticated command center, aggregate snapshot, readiness checks, exports, and non-auto-applied SQL proposal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions