add reference field to train schedules and implement unique sequence generation

This commit is contained in:
Marshal
2026-07-07 23:06:44 +00:00
parent 88b1e548a2
commit 9dd9ace313
9 changed files with 299 additions and 21 deletions

View File

@@ -61,6 +61,12 @@ export class TrainSchedule extends BaseEntity {
@Column({ name: 'train_number', type: 'varchar', length: 20, nullable: true })
trainNumber?: string | null;
// Human-facing unique schedule reference (S-YYYY-NNNNN). Shown on the schedule
// list, booking windows, and load lists. Assigned at creation from the highest
// sequence issued this year (see TrainSchedulesRepository.maxReferenceSequence).
@Column({ name: 'reference', type: 'varchar', length: 20, nullable: true, unique: true })
reference?: string | null;
@Column({ name: 'direction', type: 'varchar', length: 10, nullable: true })
direction?: string | null;