tsondb 0.21.11 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -167,6 +167,7 @@ export class TSONDB {
167
167
  },
168
168
  });
169
169
  const metaFile = await readMetaFile(options.dataRootPath);
170
+ metaFile.version = await getTSONDBVersion();
170
171
  if (metaFile.schemaVersion !== options.schema.version && options.migrationStages) {
171
172
  debug("migrating database from schema version %s to %s", metaFile.schemaVersion, options.schema.version);
172
173
  for (const stage of options.migrationStages) {
@@ -181,6 +182,8 @@ export class TSONDB {
181
182
  // oxlint-disable-next-line no-await-in-loop
182
183
  await stage.willMigrate?.(db);
183
184
  metaFile.schemaVersion = stage.toVersion;
185
+ // oxlint-disable-next-line no-await-in-loop
186
+ await writeMetaFile(options.dataRootPath, metaFile);
184
187
  }
185
188
  else {
186
189
  debug("skipping migration stage from %s to %s", stage.fromVersion, stage.toVersion);
@@ -190,9 +193,6 @@ export class TSONDB {
190
193
  else {
191
194
  debug("no migration needed, schema version is up to date");
192
195
  }
193
- metaFile.version = await getTSONDBVersion();
194
- metaFile.schemaVersion = options.schema.version;
195
- await writeMetaFile(options.dataRootPath, metaFile);
196
196
  return db;
197
197
  }
198
198
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsondb",
3
- "version": "0.21.11",
3
+ "version": "0.22.0",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Lukas Obermann",