zam-core 0.3.0 → 0.3.1
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.
- package/dist/cli/index.js +8 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Command } from "commander";
|
|
|
8
8
|
|
|
9
9
|
// src/kernel/db/connection.ts
|
|
10
10
|
import Database from "libsql";
|
|
11
|
-
import { existsSync, mkdirSync } from "fs";
|
|
11
|
+
import { existsSync, mkdirSync, rmSync } from "fs";
|
|
12
12
|
import { homedir } from "os";
|
|
13
13
|
import { dirname, join } from "path";
|
|
14
14
|
|
|
@@ -136,6 +136,13 @@ function openDatabase(options = {}) {
|
|
|
136
136
|
const dbOpts = {};
|
|
137
137
|
if (options.syncUrl) {
|
|
138
138
|
dbOpts.syncUrl = options.syncUrl;
|
|
139
|
+
const metaPath = `${dbPath}.meta`;
|
|
140
|
+
if (existsSync(dbPath) && !existsSync(metaPath)) {
|
|
141
|
+
for (const suffix of ["", "-wal", "-shm"]) {
|
|
142
|
+
const f = `${dbPath}${suffix}`;
|
|
143
|
+
if (existsSync(f)) rmSync(f);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
139
146
|
}
|
|
140
147
|
if (options.authToken) {
|
|
141
148
|
dbOpts.authToken = options.authToken;
|