1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +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:
David Leek 2024-01-29 08:07:33 +01:00 committed by GitHub
parent ce219f1b74
commit e652af49af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 5 deletions

View File

@ -79,7 +79,7 @@ exports[`should create default config 1`] = `
"caseInsensitiveInOperators": false,
"celebrateUnleash": false,
"changeRequestConflictHandling": false,
"createdByUserIdDataMigration": true,
"createdByUserIdDataMigration": false,
"customRootRolesKillSwitch": false,
"demo": false,
"detectSegmentUsageInChangeRequests": false,

View File

@ -746,15 +746,17 @@ export default class FeatureToggleStore implements IFeatureToggleStore {
.limit(batchSize)
.select(['f.*', 'ev.created_by', 'u.id', 't.username']);
toUpdate
const updatePromises = toUpdate
.filter((row) => row.id || row.username)
.forEach(async (row) => {
.map((row) => {
const id = row.id || ADMIN_TOKEN_USER.id;
await this.db(TABLE)
return this.db(TABLE)
.update({ created_by_user_id: id })
.where({ name: row.name });
});
await Promise.all(updatePromises);
}
}

View File

@ -225,7 +225,7 @@ const flags: IFlags = {
},
createdByUserIdDataMigration: parseEnvVarBoolean(
process.env.CREATED_BY_USERID_DATA_MIGRATION,
true,
false,
),
};

View File

@ -27,6 +27,7 @@ export function createTestConfig(config?: IUnleashOptions): IUnleashConfig {
flags: {
embedProxy: true,
embedProxyFrontend: true,
createdByUserIdDataMigration: true,
},
},
publicFolder: path.join(__dirname, '../examples'),