mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
Merge pull request #640 from Tria-plc/freight_feature/usermanagement
Freight feature/usermanagement
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
/**
|
||||
* Partial-batch splits no longer promote a ONE_TIME contract to GENERAL.
|
||||
* Instead the reduced booking is flagged is_split, and the booking gate lets
|
||||
* the customer book exactly the remainder under the still-ONE_TIME contract.
|
||||
*/
|
||||
export class AddBookingIsSplit2110000000000 implements MigrationInterface {
|
||||
name = 'AddBookingIsSplit2110000000000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE freight.bookings
|
||||
ADD COLUMN IF NOT EXISTS is_split BOOLEAN NOT NULL DEFAULT FALSE
|
||||
`);
|
||||
// Quantities the booking carried before the split — the remainder ledger
|
||||
// for ONE_TIME contracts, which have no quantity cap to derive it from.
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE freight.bookings
|
||||
ADD COLUMN IF NOT EXISTS pre_split_quantities JSONB NULL
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE freight.bookings DROP COLUMN IF EXISTS pre_split_quantities
|
||||
`);
|
||||
await queryRunner.query(`
|
||||
ALTER TABLE freight.bookings DROP COLUMN IF EXISTS is_split
|
||||
`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user