Fix committing metadata value migrations

In case the "oldValue" was a regex expression, the values never matched, which caused the value migration to never get committed.
This commit is contained in:
schroda
2026-05-09 14:35:09 +02:00
parent b2c14c1a5d
commit be3bb3e24e

View File

@@ -240,8 +240,11 @@ const getMetadataKeysWithUpdatedValues = (
const keysWithUpdatedValues = METADATA_MIGRATIONS.slice(migrationId).reduce((acc, migration) => {
const keysWithUpdatedValuesOfMigration = Object.keys(metadata).filter((metadataKey) =>
migration.values?.some(({ key: migrationKey, oldValue }) => {
const currentValue = metadata[metadataKey];
const isMigrationForAllKeys = !migrationKey;
const doesValueMatch = metadata[metadataKey] === oldValue;
const doesValueMatch =
oldValue instanceof RegExp ? currentValue.match(oldValue) : currentValue === oldValue;
if (isMigrationForAllKeys) {
return doesValueMatch;