import { MigrationInterface, QueryRunner } from "typeorm"

export class MakeEmployeeIdNullableInNotifications1768280361937 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    // Make employee_id nullable in notifications table
    await queryRunner.query(
      `ALTER TABLE "notifications" ALTER COLUMN "employee_id" DROP NOT NULL`,
    )
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    // Revert employee_id to NOT NULL (this might fail if there are NULL values)
    await queryRunner.query(
      `ALTER TABLE "notifications" ALTER COLUMN "employee_id" SET NOT NULL`,
    )
  }
}
