@jini-ai/db 0.6.15-rc.1 → 0.6.15-rc.2

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.
@@ -156,10 +156,8 @@ export async function runMigrations(kernel, steps, options) {
156
156
  for (const step of steps) {
157
157
  if (done.has(step.id))
158
158
  continue;
159
- if (!backedUp)
160
- await backUpBeforeChange(kernel, context);
159
+ await preparePendingStep({ kernel, context, step, backedUp });
161
160
  backedUp = true;
162
- await step.prepare?.(kernel, context);
163
161
  const applied = await kernel.transaction(async () => {
164
162
  await kernel.lockKey(ledger.lockKey);
165
163
  await ensureLedger(kernel, ledger);
@@ -173,6 +171,11 @@ export async function runMigrations(kernel, steps, options) {
173
171
  }
174
172
  return report;
175
173
  }
174
+ async function preparePendingStep({ kernel, context, step, backedUp }) {
175
+ if (!backedUp)
176
+ await backUpBeforeChange(kernel, context);
177
+ await step.prepare?.(kernel, context);
178
+ }
176
179
  /** The pre-change copy (see the file header). Outside any transaction: a backup cannot run inside one. */
177
180
  async function backUpBeforeChange(kernel, context) {
178
181
  const target = context.backupPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/db",
3
- "version": "0.6.15-rc.1",
3
+ "version": "0.6.15-rc.2",
4
4
  "description": "Database ports, connection helpers, ownership, isolated Kysely kernels and migrations. All peers are optional; drivers are injected.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -202,14 +202,14 @@
202
202
  "registry": "https://registry.npmjs.org"
203
203
  },
204
204
  "dependencies": {
205
- "@jini-ai/core": "^0.6.15-rc.1"
205
+ "@jini-ai/core": "^0.6.15-rc.2"
206
206
  },
207
207
  "peerDependencies": {
208
208
  "kysely": "^0.29.6",
209
209
  "better-sqlite3": "^13.0.0",
210
210
  "@electric-sql/pglite": "0.5.8",
211
211
  "pg": "^8.23.0",
212
- "@jini-ai/platform": "^0.6.15-rc.1"
212
+ "@jini-ai/platform": "^0.6.15-rc.2"
213
213
  },
214
214
  "peerDependenciesMeta": {
215
215
  "better-sqlite3": {
@@ -236,8 +236,8 @@
236
236
  "better-sqlite3": "13.0.3",
237
237
  "kysely": "0.29.6",
238
238
  "pg": "8.23.0",
239
- "@jini-ai/core": "0.6.15-rc.1",
240
- "@jini-ai/platform": "0.6.15-rc.1"
239
+ "@jini-ai/platform": "0.6.15-rc.2",
240
+ "@jini-ai/core": "0.6.15-rc.2"
241
241
  },
242
242
  "scripts": {
243
243
  "build": "tsc -p tsconfig.build.json",