latticesql 0.5.2 → 0.5.3
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.js +14 -4
- package/dist/index.cjs +14 -4
- package/dist/index.js +14 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -503,12 +503,22 @@ var SchemaManager = class {
|
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
/**
|
|
506
|
+
/**
|
|
507
|
+
* Query all rows from a table.
|
|
508
|
+
* Registered tables (via `define()`) are queried directly.
|
|
509
|
+
* Tables used only in entity contexts (schema managed externally) fall back
|
|
510
|
+
* to a raw SELECT with optional `deleted_at IS NULL` soft-delete filtering.
|
|
511
|
+
*/
|
|
507
512
|
queryTable(adapter, name) {
|
|
508
|
-
if (
|
|
509
|
-
|
|
513
|
+
if (this._tables.has(name)) {
|
|
514
|
+
return adapter.all(`SELECT * FROM "${name}"`);
|
|
515
|
+
}
|
|
516
|
+
if (this._entityContexts.has(name)) {
|
|
517
|
+
const cols = adapter.all(`PRAGMA table_info("${name}")`);
|
|
518
|
+
const hasDeletedAt = cols.some((c) => c.name === "deleted_at");
|
|
519
|
+
return adapter.all(`SELECT * FROM "${name}"${hasDeletedAt ? " WHERE deleted_at IS NULL" : ""}`);
|
|
510
520
|
}
|
|
511
|
-
|
|
521
|
+
throw new Error(`Unknown table: "${name}"`);
|
|
512
522
|
}
|
|
513
523
|
_ensureTable(adapter, name, columns, tableConstraints) {
|
|
514
524
|
const colDefs = Object.entries(columns).map(([col, type]) => `"${col}" ${type}`).join(", ");
|
package/dist/index.cjs
CHANGED
|
@@ -238,12 +238,22 @@ var SchemaManager = class {
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
|
-
/**
|
|
241
|
+
/**
|
|
242
|
+
* Query all rows from a table.
|
|
243
|
+
* Registered tables (via `define()`) are queried directly.
|
|
244
|
+
* Tables used only in entity contexts (schema managed externally) fall back
|
|
245
|
+
* to a raw SELECT with optional `deleted_at IS NULL` soft-delete filtering.
|
|
246
|
+
*/
|
|
242
247
|
queryTable(adapter, name) {
|
|
243
|
-
if (
|
|
244
|
-
|
|
248
|
+
if (this._tables.has(name)) {
|
|
249
|
+
return adapter.all(`SELECT * FROM "${name}"`);
|
|
250
|
+
}
|
|
251
|
+
if (this._entityContexts.has(name)) {
|
|
252
|
+
const cols = adapter.all(`PRAGMA table_info("${name}")`);
|
|
253
|
+
const hasDeletedAt = cols.some((c) => c.name === "deleted_at");
|
|
254
|
+
return adapter.all(`SELECT * FROM "${name}"${hasDeletedAt ? " WHERE deleted_at IS NULL" : ""}`);
|
|
245
255
|
}
|
|
246
|
-
|
|
256
|
+
throw new Error(`Unknown table: "${name}"`);
|
|
247
257
|
}
|
|
248
258
|
_ensureTable(adapter, name, columns, tableConstraints) {
|
|
249
259
|
const colDefs = Object.entries(columns).map(([col, type]) => `"${col}" ${type}`).join(", ");
|
package/dist/index.js
CHANGED
|
@@ -189,12 +189,22 @@ var SchemaManager = class {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* Query all rows from a table.
|
|
194
|
+
* Registered tables (via `define()`) are queried directly.
|
|
195
|
+
* Tables used only in entity contexts (schema managed externally) fall back
|
|
196
|
+
* to a raw SELECT with optional `deleted_at IS NULL` soft-delete filtering.
|
|
197
|
+
*/
|
|
193
198
|
queryTable(adapter, name) {
|
|
194
|
-
if (
|
|
195
|
-
|
|
199
|
+
if (this._tables.has(name)) {
|
|
200
|
+
return adapter.all(`SELECT * FROM "${name}"`);
|
|
201
|
+
}
|
|
202
|
+
if (this._entityContexts.has(name)) {
|
|
203
|
+
const cols = adapter.all(`PRAGMA table_info("${name}")`);
|
|
204
|
+
const hasDeletedAt = cols.some((c) => c.name === "deleted_at");
|
|
205
|
+
return adapter.all(`SELECT * FROM "${name}"${hasDeletedAt ? " WHERE deleted_at IS NULL" : ""}`);
|
|
196
206
|
}
|
|
197
|
-
|
|
207
|
+
throw new Error(`Unknown table: "${name}"`);
|
|
198
208
|
}
|
|
199
209
|
_ensureTable(adapter, name, columns, tableConstraints) {
|
|
200
210
|
const colDefs = Object.entries(columns).map(([col, type]) => `"${col}" ${type}`).join(", ");
|