Delete outdated metadata after committing updated ones
In case the outdated metadata get successfully deleted and the updated metadata fail to commit, metadata gets lost, due to not being able to apply the migrations again since the outdated metadata have already been deleted
This commit is contained in:
@@ -309,12 +309,9 @@ const commitMigratedMetadata = (
|
||||
commitedMigrations.add(itemMigrationKey);
|
||||
|
||||
try {
|
||||
await updateMetadata([...metadataToUpdate], undefined, true);
|
||||
await deleteMetadata(metadataKeysToDelete, undefined, true);
|
||||
await updateMetadata(
|
||||
[...metadataToUpdate, [getMetadataKey('migration') as AppMetadataKeys, METADATA_MIGRATIONS.length]],
|
||||
undefined,
|
||||
true,
|
||||
);
|
||||
await updateMetadata([['migration', METADATA_MIGRATIONS.length]]);
|
||||
} catch (e) {
|
||||
commitedMigrations.delete(itemMigrationKey);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user