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/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/kernel/db/connection.ts
|
|
2
2
|
import Database from "libsql";
|
|
3
|
-
import { existsSync, mkdirSync } from "fs";
|
|
3
|
+
import { existsSync, mkdirSync, rmSync } from "fs";
|
|
4
4
|
import { homedir } from "os";
|
|
5
5
|
import { dirname, join } from "path";
|
|
6
6
|
|
|
@@ -128,6 +128,13 @@ function openDatabase(options = {}) {
|
|
|
128
128
|
const dbOpts = {};
|
|
129
129
|
if (options.syncUrl) {
|
|
130
130
|
dbOpts.syncUrl = options.syncUrl;
|
|
131
|
+
const metaPath = `${dbPath}.meta`;
|
|
132
|
+
if (existsSync(dbPath) && !existsSync(metaPath)) {
|
|
133
|
+
for (const suffix of ["", "-wal", "-shm"]) {
|
|
134
|
+
const f = `${dbPath}${suffix}`;
|
|
135
|
+
if (existsSync(f)) rmSync(f);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
131
138
|
}
|
|
132
139
|
if (options.authToken) {
|
|
133
140
|
dbOpts.authToken = options.authToken;
|