import { MigrationInterface, QueryRunner } from 'typeorm';

/**
 * Per-row Remarks on Quote hotel stays.
 *
 * Mirrors the existing notes columns on query_quote_transports,
 * query_quote_activities, booking_hotel_items, and booking_transport_items.
 * Sales-pitch-time hotel notes (early check-in requests, infant cot,
 * accessibility) flow through convert-to-booking onto booking_hotel_items
 * so ops doesn't have to re-type.
 *
 * varchar(500) matches the booking-side width so any UI input handles
 * both tables identically. Nullable because existing rows pre-date this
 * feature.
 */
export class QuoteHotelNotes1781900000000 implements MigrationInterface {
  public async up(qr: QueryRunner): Promise<void> {
    await qr.query(
      `ALTER TABLE "query_quote_hotels" ADD COLUMN IF NOT EXISTS "notes" varchar(500) NULL`,
    );
  }

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