2022-07-15 09:47:18 +00:00
|
|
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
2025-02-25 06:52:50 +00:00
|
|
|
import { GroupPermission } from '@entities/group_permission.entity';
|
2021-10-25 08:35:32 +00:00
|
|
|
|
2022-07-15 09:47:18 +00:00
|
|
|
export class BackfillAppCreatePermissionsAsTruthyForAdminGroup1634729050892 implements MigrationInterface {
|
2021-10-25 08:35:32 +00:00
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
|
|
|
const entityManager = queryRunner.manager;
|
2022-07-15 09:47:18 +00:00
|
|
|
const GroupPermissionRepostory = entityManager.getRepository(GroupPermission);
|
2021-10-25 08:35:32 +00:00
|
|
|
|
2022-07-15 09:47:18 +00:00
|
|
|
await GroupPermissionRepostory.update({ group: 'admin' }, { appCreate: true, appDelete: true });
|
2021-10-25 08:35:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
|
|
|
const entityManager = queryRunner.manager;
|
2022-07-15 09:47:18 +00:00
|
|
|
const GroupPermissionRepostory = entityManager.getRepository(GroupPermission);
|
2021-10-25 08:35:32 +00:00
|
|
|
|
2022-07-15 09:47:18 +00:00
|
|
|
await GroupPermissionRepostory.update({ group: 'admin' }, { appCreate: false, appDelete: false });
|
2021-10-25 08:35:32 +00:00
|
|
|
}
|
|
|
|
|
}
|