1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +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, "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,

View File

@ -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);
} }
} }

View File

@ -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,
), ),
}; };

View File

@ -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'),