mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
|
|
export class CreateTrainSchedulingGlobalRules1751000000000 implements MigrationInterface {
|
|
name = "CreateTrainSchedulingGlobalRules1751000000000";
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`
|
|
CREATE TABLE freight.train_scheduling_global_rules (
|
|
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
max_train_length_meters numeric(10, 2) NOT NULL DEFAULT 760,
|
|
max_train_weight_tons numeric(10, 3) NOT NULL DEFAULT 3500,
|
|
max_wagons_per_train integer NOT NULL DEFAULT 53,
|
|
max_20ft_container_weight_tons numeric(8, 3) NOT NULL DEFAULT 30,
|
|
max_20ft_pair_weight_diff_tons numeric(8, 3) NOT NULL DEFAULT 10,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
deleted_at timestamptz NULL
|
|
);
|
|
`);
|
|
|
|
await queryRunner.query(`
|
|
INSERT INTO freight.train_scheduling_global_rules (
|
|
max_train_length_meters,
|
|
max_train_weight_tons,
|
|
max_wagons_per_train,
|
|
max_20ft_container_weight_tons,
|
|
max_20ft_pair_weight_diff_tons
|
|
) VALUES (760, 3500, 53, 30, 10);
|
|
`);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`DROP TABLE IF EXISTS freight.train_scheduling_global_rules;`);
|
|
}
|
|
}
|