import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddPreferredLanguage1745000000000 implements MigrationInterface {
  name = 'AddPreferredLanguage1745000000000';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      ALTER TABLE "users"
      ADD COLUMN "preferred_language" VARCHAR(2) NOT NULL DEFAULT 'fr'
    `);
    await queryRunner.query(`
      ALTER TABLE "organizations"
      ADD COLUMN "default_language" VARCHAR(2) NOT NULL DEFAULT 'fr'
    `);
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`
      ALTER TABLE "organizations" DROP COLUMN "default_language"
    `);
    await queryRunner.query(`
      ALTER TABLE "users" DROP COLUMN "preferred_language"
    `);
  }
}
