import { readFileSync } from 'node:fs'; import { join } from 'node:path'; describe('orchestration migration safety', () => { it('is additive and never mutates legacy governance tables', () => { const sql = readFileSync( join( process.cwd(), 'prisma/migrations/20261022000000_add_orchestration_v4_core/migration.sql', ), 'utf8', ); expect(sql).not.toMatch(/^\s*(DROP|TRUNCATE|DELETE|UPDATE)\b/im); expect(sql).not.toMatch( /ALTER TABLE "(approval_requests|department_tasks|audit_logs)"/i, ); expect(sql.match(/CREATE TABLE "orchestration_/g)).toHaveLength(9); }); });