Support regex in metadata value migration

This commit is contained in:
schroda
2024-12-10 21:13:10 +01:00
parent 5cda9a3972
commit 45bedfaddb
2 changed files with 2 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ export interface IMetadataMigration {
* Otherwise, all metadata keys will get migrated.
*/
key?: string;
oldValue: string;
oldValue: string | RegExp;
newValue: string;
}[];
keys?: { oldKey: string; newKey: string }[];

View File

@@ -59,7 +59,7 @@ const applyMetadataValueMigration = (meta: Metadata, migration: IMetadataMigrati
metadataValueChanges.forEach(({ key, oldValue, newValue }) => {
const migrateValue = (metaKey: string) => {
if (meta[metaKey] === oldValue) {
if (meta[metaKey].match(oldValue)) {
migratedMetadata[metaKey] = newValue;
}
};