import { MigrationInterface, QueryRunner } from 'typeorm';

// 화상회의 방에 예약 시각/참여 허용 사용자 컬럼 추가 (단계 4: 방 관리).
// 운영(migrationsRun)에서만 실행되며, dev 는 synchronize 로 자동 반영된다.
export class AddMeetingRoomFields1782800000000 implements MigrationInterface {
  name = 'AddMeetingRoomFields1782800000000';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "meeting_rooms" ADD "scheduled_at" TIMESTAMP`,
    );
    await queryRunner.query(
      `ALTER TABLE "meeting_rooms" ADD "allowed_user_ids" text`,
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "meeting_rooms" DROP COLUMN "allowed_user_ids"`,
    );
    await queryRunner.query(
      `ALTER TABLE "meeting_rooms" DROP COLUMN "scheduled_at"`,
    );
  }
}
