db(f4): drop legacy director report workflow
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
/**
|
||||
* Retira definitivamente el circuito legacy Director -> revisión -> aprobación -> firma.
|
||||
*
|
||||
* current_revision_number se conserva porque pertenece al versionado útil del INF y no
|
||||
* al circuito de aprobación retirado.
|
||||
*/
|
||||
export class F4RemoveDirectorReportLegacy1790000400000 implements MigrationInterface {
|
||||
name = 'F4RemoveDirectorReportLegacy1790000400000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
// Las entregas al Director pertenecían al flujo retirado y no deben seguir
|
||||
// apareciendo como pendientes/reintentables en F4.
|
||||
await queryRunner.query(`
|
||||
DELETE FROM inspection_document_deliveries
|
||||
WHERE recipient_kind = 'DIRECTOR'
|
||||
`);
|
||||
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports DROP COLUMN IF EXISTS approved_revision_id`);
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports DROP COLUMN IF EXISTS approved_by`);
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports DROP COLUMN IF EXISTS approved_at`);
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports DROP COLUMN IF EXISTS review_note`);
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports DROP COLUMN IF EXISTS signed_at`);
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports DROP COLUMN IF EXISTS review_status`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
// El rollback reconstruye la forma del esquema, pero no recrea entregas Director
|
||||
// ni datos de aprobación eliminados. El backup PRE-F4 es la fuente de recuperación
|
||||
// si alguna vez fuera necesario volver a ese circuito.
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE inspection_reports
|
||||
ADD COLUMN IF NOT EXISTS review_status varchar(32) NOT NULL DEFAULT 'PENDING_REVIEW'
|
||||
`);
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports ADD COLUMN IF NOT EXISTS approved_revision_id uuid`);
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports ADD COLUMN IF NOT EXISTS approved_by uuid`);
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports ADD COLUMN IF NOT EXISTS approved_at timestamptz`);
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports ADD COLUMN IF NOT EXISTS review_note varchar(1000)`);
|
||||
await queryRunner.query(`ALTER TABLE inspection_reports ADD COLUMN IF NOT EXISTS signed_at timestamptz`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user