mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 23:00:57 +00:00
26 lines
821 B
TypeScript
26 lines
821 B
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
export class AddWagonReadiness1750500000000 implements MigrationInterface {
|
|
name = 'AddWagonReadiness1750500000000';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
ALTER TABLE freight.wagons
|
|
ADD COLUMN IF NOT EXISTS readiness VARCHAR(20) NOT NULL DEFAULT 'IMPORT_READY'
|
|
`);
|
|
await queryRunner.query(`
|
|
CREATE INDEX IF NOT EXISTS idx_wagons_readiness
|
|
ON freight.wagons (readiness)
|
|
WHERE deleted_at IS NULL
|
|
`);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`DROP INDEX IF EXISTS freight.idx_wagons_readiness`);
|
|
await queryRunner.query(`
|
|
ALTER TABLE freight.wagons
|
|
DROP COLUMN IF EXISTS readiness
|
|
`);
|
|
}
|
|
}
|