30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
export class AddColumnSourceAtUserLogin1726642499135
|
|
implements MigrationInterface
|
|
{
|
|
name = 'AddColumnSourceAtUserLogin1726642499135';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(
|
|
`CREATE TYPE "public"."users_login_role_enum" AS ENUM('superadmin', 'staff', 'tenant', 'queue_admin')`,
|
|
);
|
|
await queryRunner.query(
|
|
`ALTER TABLE "users_login" ADD "role" "public"."users_login_role_enum"`,
|
|
);
|
|
await queryRunner.query(
|
|
`CREATE TYPE "public"."users_login_source_enum" AS ENUM('POS_ADMIN', 'POS_COUNTER', 'QUEUE_ADMIN', 'QUEUE_CUSTOMER')`,
|
|
);
|
|
await queryRunner.query(
|
|
`ALTER TABLE "users_login" ADD "source" "public"."users_login_source_enum"`,
|
|
);
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`ALTER TABLE "users_login" DROP COLUMN "source"`);
|
|
await queryRunner.query(`DROP TYPE "public"."users_login_source_enum"`);
|
|
await queryRunner.query(`ALTER TABLE "users_login" DROP COLUMN "role"`);
|
|
await queryRunner.query(`DROP TYPE "public"."users_login_role_enum"`);
|
|
}
|
|
}
|