import { MigrationInterface, QueryRunner } from 'typeorm';

export class CreateRoles1751524036124 implements MigrationInterface {
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.manager.insert('roles', [
      {
        role_name: 'Root',
        role_key: 'root',
      },
      {
        role_name: 'Manager',
        role_key: 'manager',
        inherits: ['abc', 'ced'],
      },
      {
        role_name: 'abc',
        role_key: 'abc',
        inherits: ['ced'],
      },
      {
        role_name: 'cde',
        role_key: 'ced',
        inherits: [],
      },
      {
        role_name: 'def',
        role_key: 'def',
        inherits: ['manager'],
      },
    ]);
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.manager.delete('roles', []);
  }
}
