Page MenuHomePhabricator

D12049.id40209.diff
No OneTemporary

D12049.id40209.diff

diff --git a/lib/utils/migration-utils.js b/lib/utils/migration-utils.js
--- a/lib/utils/migration-utils.js
+++ b/lib/utils/migration-utils.js
@@ -208,6 +208,7 @@
+[number | string]: (PersistedState) => Promise<{
+state: PersistedState,
+ops: StoreOperations,
+ +changesSchema?: boolean,
}>,
};
@@ -247,7 +248,7 @@
return state;
}
- return await runMigrations(
+ const { state: newState } = await runMigrations(
legacyMigrations,
migrations,
state,
@@ -255,6 +256,8 @@
currentVersion,
debug,
);
+
+ return newState;
};
}
@@ -265,7 +268,10 @@
inboundVersion: number,
currentVersion: number,
debug: boolean,
-): Promise<PersistedState> {
+): Promise<{
+ +state: PersistedState,
+ +schemaChanged: boolean,
+}> {
const migrationKeys = [
...Object.keys(legacyMigrations),
...Object.keys(migrations),
@@ -279,6 +285,7 @@
}
let migratedState: PersistedState = state;
+ let schemaChanged = false;
for (const versionKey of sortedMigrationKeys) {
if (debug) {
console.log(
@@ -294,8 +301,12 @@
if (legacyMigrations[versionKey]) {
migratedState = await legacyMigrations[versionKey](migratedState);
} else {
- const { state: newState, ops } =
- await migrations[versionKey](migratedState);
+ const {
+ state: newState,
+ ops,
+ changesSchema,
+ } = await migrations[versionKey](migratedState);
+ schemaChanged ||= !!changesSchema;
migratedState = newState;
const versionUpdateOp = {
type: 'replace_synced_metadata_entry',
@@ -315,7 +326,7 @@
}
}
- return migratedState;
+ return { state: migratedState, schemaChanged };
}
export {

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 9:00 PM (14 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692646
Default Alt Text
D12049.id40209.diff (1 KB)

Event Timeline