mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
82 lines
2.0 KiB
TypeScript
82 lines
2.0 KiB
TypeScript
import { MigrationInterface, QueryRunner, Table, TableIndex } from 'typeorm';
|
|
|
|
export class CreateTrainCompositionRemovalLog1781000000005 implements MigrationInterface {
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.createTable(
|
|
new Table({
|
|
schema: 'freight',
|
|
name: 'train_composition_removal_logs',
|
|
columns: [
|
|
{
|
|
name: 'id',
|
|
type: 'uuid',
|
|
isPrimary: true,
|
|
default: 'uuid_generate_v4()',
|
|
},
|
|
{
|
|
name: 'schedule_id',
|
|
type: 'uuid',
|
|
isNullable: false,
|
|
},
|
|
{
|
|
name: 'booking_id',
|
|
type: 'uuid',
|
|
isNullable: false,
|
|
},
|
|
{
|
|
name: 'booking_reference',
|
|
type: 'varchar',
|
|
length: '64',
|
|
isNullable: true,
|
|
},
|
|
{
|
|
name: 'removed_by_user_id',
|
|
type: 'uuid',
|
|
isNullable: true,
|
|
},
|
|
{
|
|
name: 'removed_at',
|
|
type: 'timestamptz',
|
|
default: 'NOW()',
|
|
isNullable: false,
|
|
},
|
|
{
|
|
name: 'notes',
|
|
type: 'text',
|
|
isNullable: true,
|
|
},
|
|
{
|
|
name: 'created_at',
|
|
type: 'timestamptz',
|
|
default: 'NOW()',
|
|
isNullable: false,
|
|
},
|
|
{
|
|
name: 'updated_at',
|
|
type: 'timestamptz',
|
|
default: 'NOW()',
|
|
isNullable: false,
|
|
},
|
|
{
|
|
name: 'deleted_at',
|
|
type: 'timestamptz',
|
|
isNullable: true,
|
|
},
|
|
],
|
|
}),
|
|
true,
|
|
);
|
|
|
|
await queryRunner.createIndex(
|
|
'freight.train_composition_removal_logs',
|
|
new TableIndex({
|
|
columnNames: ['schedule_id'],
|
|
}),
|
|
);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.dropTable('freight.train_composition_removal_logs', true);
|
|
}
|
|
}
|