intercity fix

This commit is contained in:
Marshal
2026-07-31 10:26:17 +00:00
parent d07a2e239e
commit 74b7ee81fc
11 changed files with 679 additions and 49 deletions

View File

@@ -0,0 +1,25 @@
import { MigrationInterface, QueryRunner } from "typeorm";
/**
* The draft/finalize phase is abolished: train schedules are created SCHEDULED
* and the Finalize button is gone from the backoffice. Promote every surviving
* DRAFT schedule so it stays reachable (dispatch requires SCHEDULED and there
* is no manual promotion path anymore). Idempotent; one-way — the original
* DRAFT set is not recorded, so down() cannot restore it.
*/
export class PromoteDraftSchedulesToScheduled3100000000000 implements MigrationInterface {
name = "PromoteDraftSchedulesToScheduled3100000000000";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`UPDATE freight.train_schedules
SET status = 'SCHEDULED'
WHERE status = 'DRAFT'
AND deleted_at IS NULL`,
);
}
public async down(): Promise<void> {
// One-way data promotion — nothing to restore.
}
}