Files
canina/backend/prisma/MIGRATION_BASELINE.md
T

1.3 KiB

Prisma migration baseline and Orchestration v4 rollout

The production databases predate complete migration tracking for the legacy governance tables (approval_requests, department_tasks, and audit_logs). Do not run prisma db push, reset, or edit an applied migration.

Safe baseline procedure (per environment, during a CI/CD maintenance step)

  1. Back up the database and verify restore capability.
  2. Run prisma migrate status and compare the live schema to the reviewed migrations.
  3. For migrations whose objects already exist in that environment, record them without executing SQL using prisma migrate resolve --applied <migration_name>. This is an environment-specific reconciliation step; never guess which migrations are present.
  4. Review 20261022000000_add_orchestration_v4_core/migration.sql. It is additive: it creates only orchestration_* tables, indexes, and foreign keys. It does not alter or copy legacy governance data.
  5. Apply through CI/CD only with prisma migrate deploy; validate counts and application health. No production deployment is part of this change.

Rollback is application-first: stop use of the new module while retaining its append-only records. Do not drop tables in an automated rollback. Any later removal requires a separately reviewed archival migration.