@minatojs/driver-sqlite
Advanced tools
Comparing version 3.4.3 to 3.4.4
@@ -118,3 +118,3 @@ "use strict"; | ||
__name(SQLiteBuilder, "SQLiteBuilder"); | ||
var _joinKeys, joinKeys_fn, _exec, exec_fn, _all, all_fn, _get, get_fn, _run, run_fn, _update, update_fn, _create, create_fn; | ||
var _joinKeys, joinKeys_fn, _exec, exec_fn, _all, all_fn, _get, get_fn, _export, export_fn, _run, run_fn, _update, update_fn, _create, create_fn; | ||
var SQLiteDriver = class extends import_core.Driver { | ||
@@ -128,2 +128,3 @@ constructor(database, config) { | ||
__privateAdd(this, _get); | ||
__privateAdd(this, _export); | ||
__privateAdd(this, _run); | ||
@@ -186,3 +187,3 @@ __privateAdd(this, _update); | ||
} else if (shouldMigrate) { | ||
for (const { name, type, notnull, pk, dflt_value } of columns) { | ||
for (const { name, type, notnull, pk, dflt_value: value } of columns) { | ||
if (mapping[name] || (dropKeys == null ? void 0 : dropKeys.includes(name))) | ||
@@ -194,4 +195,4 @@ continue; | ||
def += " PRIMARY KEY"; | ||
if (dflt_value !== null) | ||
def += " DEFAULT " + this.sql.escape(dflt_value); | ||
if (value !== null) | ||
def += " DEFAULT " + this.sql.escape(value); | ||
columnDefs.push(def); | ||
@@ -253,2 +254,3 @@ mapping[name] = name; | ||
var _a; | ||
await new Promise((resolve) => setTimeout(resolve, 0)); | ||
(_a = this.db) == null ? void 0 : _a.close(); | ||
@@ -375,2 +377,8 @@ } | ||
}, "#get"); | ||
_export = new WeakSet(); | ||
export_fn = /* @__PURE__ */ __name(function() { | ||
const data = this.db.export(); | ||
import_fs.promises.writeFile(this.config.path, data); | ||
this.init(data); | ||
}, "#export"); | ||
_run = new WeakSet(); | ||
@@ -381,9 +389,4 @@ run_fn = /* @__PURE__ */ __name(function(sql, params = [], callback) { | ||
if (this.config.path) { | ||
const data = this.db.export(); | ||
const timer = this.writeTask = setTimeout(() => { | ||
if (this.writeTask !== timer) | ||
return; | ||
import_fs.promises.writeFile(this.config.path, data); | ||
}, 0); | ||
this.init(data); | ||
clearTimeout(this.writeTask); | ||
this.writeTask = setTimeout(() => __privateMethod(this, _export, export_fn).call(this), 0); | ||
} | ||
@@ -390,0 +393,0 @@ return result; |
{ | ||
"name": "@minatojs/driver-sqlite", | ||
"version": "3.4.3", | ||
"version": "3.4.4", | ||
"description": "SQLite Driver for Minato", | ||
@@ -36,5 +36,5 @@ "main": "lib/index.js", | ||
"@minatojs/sql.js": "^2.0.1", | ||
"cosmokit": "^1.4.1", | ||
"cosmokit": "^1.4.2", | ||
"reggol": "^1.3.5" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42723
452
Updatedcosmokit@^1.4.2