mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 23:28:11 +00:00
Merge pull request #943 from Tria-plc/freight_feature/usermanagement
changes
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
/**
|
||||
* Lashing is now BULK-only and sold per trade direction (IMPORT / EXPORT),
|
||||
* optionally narrowed to one leaf commodity. Rates that no longer fit —
|
||||
* container-scoped, or carrying no direction — cannot be mapped and are
|
||||
* retired (SUPERSEDED + soft-deleted), kept readable for snapshot history.
|
||||
* Matched on trigger, not rate_type (CONSOLIDATION shares rate_type LASHING).
|
||||
*/
|
||||
export class LashingBulkOnlyPerDirection2890000000000 implements MigrationInterface {
|
||||
name = 'LashingBulkOnlyPerDirection2890000000000';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`
|
||||
UPDATE freight.rates
|
||||
SET status = 'SUPERSEDED',
|
||||
deleted_at = now(),
|
||||
updated_at = now()
|
||||
WHERE deleted_at IS NULL
|
||||
AND "trigger" = 'LASHING'
|
||||
AND (container_type_id IS NOT NULL
|
||||
OR trade_direction IS NULL
|
||||
OR trade_direction NOT IN ('IMPORT', 'EXPORT'));
|
||||
`);
|
||||
}
|
||||
|
||||
public async down(): Promise<void> {
|
||||
// Retired rates stay retired — re-enter per-direction bulk rates instead.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user