mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	chore: default the data migration flag for createdbyuserid to false (#6048)
## About the changes Sets data migration of features and events created_by_user_id to disabled by default Map to promise and await all in created by user id migration for features
This commit is contained in:
		
							parent
							
								
									ce219f1b74
								
							
						
					
					
						commit
						e652af49af
					
				@ -79,7 +79,7 @@ exports[`should create default config 1`] = `
 | 
				
			|||||||
      "caseInsensitiveInOperators": false,
 | 
					      "caseInsensitiveInOperators": false,
 | 
				
			||||||
      "celebrateUnleash": false,
 | 
					      "celebrateUnleash": false,
 | 
				
			||||||
      "changeRequestConflictHandling": false,
 | 
					      "changeRequestConflictHandling": false,
 | 
				
			||||||
      "createdByUserIdDataMigration": true,
 | 
					      "createdByUserIdDataMigration": false,
 | 
				
			||||||
      "customRootRolesKillSwitch": false,
 | 
					      "customRootRolesKillSwitch": false,
 | 
				
			||||||
      "demo": false,
 | 
					      "demo": false,
 | 
				
			||||||
      "detectSegmentUsageInChangeRequests": false,
 | 
					      "detectSegmentUsageInChangeRequests": false,
 | 
				
			||||||
 | 
				
			|||||||
@ -746,15 +746,17 @@ export default class FeatureToggleStore implements IFeatureToggleStore {
 | 
				
			|||||||
            .limit(batchSize)
 | 
					            .limit(batchSize)
 | 
				
			||||||
            .select(['f.*', 'ev.created_by', 'u.id', 't.username']);
 | 
					            .select(['f.*', 'ev.created_by', 'u.id', 't.username']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        toUpdate
 | 
					        const updatePromises = toUpdate
 | 
				
			||||||
            .filter((row) => row.id || row.username)
 | 
					            .filter((row) => row.id || row.username)
 | 
				
			||||||
            .forEach(async (row) => {
 | 
					            .map((row) => {
 | 
				
			||||||
                const id = row.id || ADMIN_TOKEN_USER.id;
 | 
					                const id = row.id || ADMIN_TOKEN_USER.id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                await this.db(TABLE)
 | 
					                return this.db(TABLE)
 | 
				
			||||||
                    .update({ created_by_user_id: id })
 | 
					                    .update({ created_by_user_id: id })
 | 
				
			||||||
                    .where({ name: row.name });
 | 
					                    .where({ name: row.name });
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        await Promise.all(updatePromises);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -225,7 +225,7 @@ const flags: IFlags = {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    createdByUserIdDataMigration: parseEnvVarBoolean(
 | 
					    createdByUserIdDataMigration: parseEnvVarBoolean(
 | 
				
			||||||
        process.env.CREATED_BY_USERID_DATA_MIGRATION,
 | 
					        process.env.CREATED_BY_USERID_DATA_MIGRATION,
 | 
				
			||||||
        true,
 | 
					        false,
 | 
				
			||||||
    ),
 | 
					    ),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -27,6 +27,7 @@ export function createTestConfig(config?: IUnleashOptions): IUnleashConfig {
 | 
				
			|||||||
            flags: {
 | 
					            flags: {
 | 
				
			||||||
                embedProxy: true,
 | 
					                embedProxy: true,
 | 
				
			||||||
                embedProxyFrontend: true,
 | 
					                embedProxyFrontend: true,
 | 
				
			||||||
 | 
					                createdByUserIdDataMigration: true,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        publicFolder: path.join(__dirname, '../examples'),
 | 
					        publicFolder: path.join(__dirname, '../examples'),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user