Support regex in metadata value migration
This commit is contained in:
@@ -20,7 +20,7 @@ export interface IMetadataMigration {
|
|||||||
* Otherwise, all metadata keys will get migrated.
|
* Otherwise, all metadata keys will get migrated.
|
||||||
*/
|
*/
|
||||||
key?: string;
|
key?: string;
|
||||||
oldValue: string;
|
oldValue: string | RegExp;
|
||||||
newValue: string;
|
newValue: string;
|
||||||
}[];
|
}[];
|
||||||
keys?: { oldKey: string; newKey: string }[];
|
keys?: { oldKey: string; newKey: string }[];
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ const applyMetadataValueMigration = (meta: Metadata, migration: IMetadataMigrati
|
|||||||
|
|
||||||
metadataValueChanges.forEach(({ key, oldValue, newValue }) => {
|
metadataValueChanges.forEach(({ key, oldValue, newValue }) => {
|
||||||
const migrateValue = (metaKey: string) => {
|
const migrateValue = (metaKey: string) => {
|
||||||
if (meta[metaKey] === oldValue) {
|
if (meta[metaKey].match(oldValue)) {
|
||||||
migratedMetadata[metaKey] = newValue;
|
migratedMetadata[metaKey] = newValue;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user