import { MigrationInterface, QueryRunner } from 'typeorm';

/**
 * Per-row pax on quote transport lines (2026-10-15). NULL = the full
 * party (query adults / children) — the pre-existing behaviour, so no
 * backfill is needed. Booking transport rows already carry the same
 * figures as adults_override / children_override; createFromQuery
 * copies these across on conversion.
 */
export class QuoteTransportRowPax1788000000000 implements MigrationInterface {
  name = 'QuoteTransportRowPax1788000000000';

  public async up(qr: QueryRunner): Promise<void> {
    await qr.query(`
      ALTER TABLE "query_quote_transports"
        ADD COLUMN IF NOT EXISTS "adults" integer NULL,
        ADD COLUMN IF NOT EXISTS "children" integer NULL
    `);
  }

  public async down(qr: QueryRunner): Promise<void> {
    await qr.query(`ALTER TABLE "query_quote_transports" DROP COLUMN IF EXISTS "children"`);
    await qr.query(`ALTER TABLE "query_quote_transports" DROP COLUMN IF EXISTS "adults"`);
  }
}
