import { MigrationInterface, QueryRunner } from "typeorm";

/**
 * Store the driver's gender. Prefilled from the Fayda VERIFY response
 * (Male/Female) but editable; nullable so existing rows and manual,
 * non-Fayda driver records stay valid.
 */
export class AddDriverGender1890000000005 implements MigrationInterface {
  name = "AddDriverGender1890000000005";

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      ALTER TABLE freight.drivers
      ADD COLUMN IF NOT EXISTS gender varchar
    `);
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      ALTER TABLE freight.drivers
      DROP COLUMN IF EXISTS gender
    `);
  }
}
