import { MigrationInterface, QueryRunner } from 'typeorm';

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

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `CREATE TYPE "public"."log_users_login_source_enum" AS ENUM('POS_ADMIN', 'POS_COUNTER', 'QUEUE_ADMIN', 'QUEUE_CUSTOMER')`,
    );
    await queryRunner.query(
      `ALTER TABLE "log_users_login" ADD "source" "public"."log_users_login_source_enum"`,
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "log_users_login" DROP COLUMN "source"`,
    );
    await queryRunner.query(`DROP TYPE "public"."log_users_login_source_enum"`);
  }
}
