
const { v4: uuid } = require("uuid");

module.exports = {
  /**
   * @param{import("sequelize").QueryInterface} queryInterface
   * @return {Promise<void>}
   */
  async up(queryInterface) {
    const createdAt = new Date();
    const updatedAt = new Date();

    /** @type {Map<string, string>} */
    const idMap = new Map();

    /**
     * @param {string} key
     * @return {string}
     */
    function getId(key) {
      if (idMap.has(key)) {
        return idMap.get(key);
      }
      const id = uuid();
      idMap.set(key, id);
      return id;
    }

    await queryInterface.bulkInsert("roles", [
      
      
      { id: getId("Administrator"), name: "Administrator", createdAt, updatedAt },
      
      
        
          { id: getId("PlatformOwner"), name: "Platform Owner", createdAt, updatedAt },
        
          { id: getId("DataOpsLead"), name: "Data Ops Lead", createdAt, updatedAt },
        
          { id: getId("GameOpsManager"), name: "Game Ops Manager", createdAt, updatedAt },
        
          { id: getId("SupportAnalyst"), name: "Support Analyst", createdAt, updatedAt },
        
          { id: getId("Player"), name: "Player", createdAt, updatedAt },
        
      
      
      { id: getId("Public"), name: "Public", createdAt, updatedAt },
    ]);

    /**
     * @param {string} name
     */
    function createPermissions(name) {
      return [
        { id: getId(`CREATE_${name.toUpperCase()}`), createdAt, updatedAt, name: `CREATE_${name.toUpperCase()}` },
        { id: getId(`READ_${name.toUpperCase()}`), createdAt, updatedAt, name: `READ_${name.toUpperCase()}` },
        { id: getId(`UPDATE_${name.toUpperCase()}`), createdAt, updatedAt, name: `UPDATE_${name.toUpperCase()}` },
        { id: getId(`DELETE_${name.toUpperCase()}`), createdAt, updatedAt, name: `DELETE_${name.toUpperCase()}` }
      ];
    }

    const entities = [
      "users","roles","permissions","osu_api_credentials","api_request_logs","sync_jobs","beatmap_sets","mappers","artists","beatmaps","mapper_stats","artist_stats","game_sessions","game_rounds","leaderboard_entries","daily_seeds","server_caches",,
    ];
await queryInterface.bulkInsert("permissions", entities.flatMap(createPermissions));
await queryInterface.bulkInsert("permissions", [{ id: getId(`READ_API_DOCS`), createdAt, updatedAt, name: `READ_API_DOCS` }]);
await queryInterface.bulkInsert("permissions", [{ id: getId(`CREATE_SEARCH`), createdAt, updatedAt, name: `CREATE_SEARCH`}]);


await queryInterface.sequelize.query(`create table "rolesPermissionsPermissions"
(
"createdAt"           timestamp with time zone not null,
"updatedAt"           timestamp with time zone not null,
"roles_permissionsId" uuid                     not null,
"permissionId"        uuid                     not null,
primary key ("roles_permissionsId", "permissionId")
);`);


await queryInterface.bulkInsert("rolesPermissionsPermissions", [
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_USERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_USERS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_USERS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_USERS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_USERS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_USERS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_OSU_API_CREDENTIALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_OSU_API_CREDENTIALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_OSU_API_CREDENTIALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_OSU_API_CREDENTIALS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('CREATE_OSU_API_CREDENTIALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_OSU_API_CREDENTIALS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_OSU_API_CREDENTIALS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_API_REQUEST_LOGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_API_REQUEST_LOGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_API_REQUEST_LOGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_API_REQUEST_LOGS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_API_REQUEST_LOGS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_API_REQUEST_LOGS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_API_REQUEST_LOGS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_API_REQUEST_LOGS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_SYNC_JOBS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_SYNC_JOBS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_SYNC_JOBS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_SYNC_JOBS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('CREATE_SYNC_JOBS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_SYNC_JOBS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_SYNC_JOBS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('DELETE_SYNC_JOBS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_SYNC_JOBS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('UPDATE_SYNC_JOBS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_SYNC_JOBS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_BEATMAP_SETS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_BEATMAP_SETS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_BEATMAP_SETS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_BEATMAP_SETS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('CREATE_BEATMAP_SETS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_BEATMAP_SETS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_BEATMAP_SETS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_BEATMAP_SETS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('UPDATE_BEATMAP_SETS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_BEATMAP_SETS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_BEATMAP_SETS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_MAPPERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_MAPPERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_MAPPERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_MAPPERS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('CREATE_MAPPERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_MAPPERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_MAPPERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_MAPPERS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('UPDATE_MAPPERS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_MAPPERS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_MAPPERS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_ARTISTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_ARTISTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_ARTISTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_ARTISTS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('CREATE_ARTISTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_ARTISTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_ARTISTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_ARTISTS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('UPDATE_ARTISTS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_ARTISTS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_ARTISTS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_BEATMAPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_BEATMAPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_BEATMAPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_BEATMAPS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('CREATE_BEATMAPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_BEATMAPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_BEATMAPS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_BEATMAPS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('UPDATE_BEATMAPS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_BEATMAPS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_BEATMAPS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_MAPPER_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_MAPPER_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_MAPPER_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_MAPPER_STATS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('CREATE_MAPPER_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_MAPPER_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_MAPPER_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('DELETE_MAPPER_STATS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_MAPPER_STATS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_MAPPER_STATS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_MAPPER_STATS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_ARTIST_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_ARTIST_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_ARTIST_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_ARTIST_STATS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('CREATE_ARTIST_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_ARTIST_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_ARTIST_STATS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('DELETE_ARTIST_STATS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_ARTIST_STATS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_ARTIST_STATS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_ARTIST_STATS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_GAME_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_GAME_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_GAME_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_GAME_SESSIONS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_GAME_SESSIONS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_GAME_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('UPDATE_GAME_SESSIONS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_GAME_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('UPDATE_GAME_SESSIONS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('CREATE_GAME_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_GAME_SESSIONS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('UPDATE_GAME_SESSIONS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_GAME_ROUNDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_GAME_ROUNDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_GAME_ROUNDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_GAME_ROUNDS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_GAME_ROUNDS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_GAME_ROUNDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('UPDATE_GAME_ROUNDS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_GAME_ROUNDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('UPDATE_GAME_ROUNDS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('CREATE_GAME_ROUNDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_GAME_ROUNDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('UPDATE_GAME_ROUNDS') },
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_LEADERBOARD_ENTRIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_LEADERBOARD_ENTRIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_LEADERBOARD_ENTRIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_LEADERBOARD_ENTRIES') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_LEADERBOARD_ENTRIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_LEADERBOARD_ENTRIES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('CREATE_LEADERBOARD_ENTRIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_LEADERBOARD_ENTRIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('UPDATE_LEADERBOARD_ENTRIES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_LEADERBOARD_ENTRIES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('UPDATE_LEADERBOARD_ENTRIES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_LEADERBOARD_ENTRIES') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_DAILY_SEEDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_DAILY_SEEDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_DAILY_SEEDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_DAILY_SEEDS') },
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('CREATE_DAILY_SEEDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_DAILY_SEEDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_DAILY_SEEDS') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('CREATE_DAILY_SEEDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_DAILY_SEEDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('UPDATE_DAILY_SEEDS') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('DELETE_DAILY_SEEDS') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('READ_DAILY_SEEDS') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('READ_DAILY_SEEDS') },
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
    
      
      
          
                
                
               
                
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_SERVER_CACHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('READ_SERVER_CACHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('UPDATE_SERVER_CACHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('DELETE_SERVER_CACHES') },
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('READ_SERVER_CACHES') },
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('UPDATE_SERVER_CACHES') },
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                      { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('READ_SERVER_CACHES') },
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
                
               
                
                  
                    
                  
                    
                  
                    
                  
                    
                  
                  
             
          
    
  
    
     
  
      
      
        
            { createdAt, updatedAt, roles_permissionsId: getId("PlatformOwner"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("DataOpsLead"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("GameOpsManager"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("SupportAnalyst"), permissionId: getId('CREATE_SEARCH') },
        
            { createdAt, updatedAt, roles_permissionsId: getId("Player"), permissionId: getId('CREATE_SEARCH') },
        
      
      
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_USERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_USERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_USERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_USERS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_ROLES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_ROLES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_ROLES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_ROLES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_PERMISSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_PERMISSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_PERMISSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_PERMISSIONS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_OSU_API_CREDENTIALS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_OSU_API_CREDENTIALS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_OSU_API_CREDENTIALS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_OSU_API_CREDENTIALS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_API_REQUEST_LOGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_API_REQUEST_LOGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_API_REQUEST_LOGS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_API_REQUEST_LOGS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_SYNC_JOBS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_SYNC_JOBS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_SYNC_JOBS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_SYNC_JOBS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_BEATMAP_SETS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_BEATMAP_SETS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_BEATMAP_SETS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_BEATMAP_SETS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_MAPPERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_MAPPERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_MAPPERS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_MAPPERS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_ARTISTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_ARTISTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_ARTISTS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_ARTISTS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_BEATMAPS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_BEATMAPS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_BEATMAPS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_BEATMAPS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_MAPPER_STATS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_MAPPER_STATS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_MAPPER_STATS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_MAPPER_STATS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_ARTIST_STATS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_ARTIST_STATS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_ARTIST_STATS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_ARTIST_STATS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_GAME_SESSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_GAME_SESSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_GAME_SESSIONS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_GAME_SESSIONS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_GAME_ROUNDS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_GAME_ROUNDS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_GAME_ROUNDS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_GAME_ROUNDS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_LEADERBOARD_ENTRIES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_LEADERBOARD_ENTRIES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_LEADERBOARD_ENTRIES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_LEADERBOARD_ENTRIES') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_DAILY_SEEDS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_DAILY_SEEDS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_DAILY_SEEDS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_DAILY_SEEDS') },
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_SERVER_CACHES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_SERVER_CACHES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('UPDATE_SERVER_CACHES') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('DELETE_SERVER_CACHES') },
    
    
    
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('READ_API_DOCS') },
    { createdAt, updatedAt, roles_permissionsId: getId("Administrator"), permissionId: getId('CREATE_SEARCH') },
    ]);


  await queryInterface.sequelize.query(`UPDATE "users" SET "app_roleId"='${getId("SuperAdmin")}' WHERE "email"='super_admin@flatlogic.com'`);
  await queryInterface.sequelize.query(`UPDATE "users" SET "app_roleId"='${getId("Administrator")}' WHERE "email"='admin@flatlogic.com'`);
  
   
      
      
        
        
           await queryInterface.sequelize.query(`UPDATE "users" SET "app_roleId"='${getId("PlatformOwner")}' WHERE "email"='client@hello.com'`);
        await queryInterface.sequelize.query(`UPDATE "users" SET "app_roleId"='${getId("DataOpsLead")}' WHERE "email"='john@doe.com'`);
       
      
      

}
};

