latticesql 1.6.7 → 1.6.9
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 +7 -0
- package/dist/index.cjs +7 -0
- package/dist/index.js +7 -0
- package/dist/postgres-worker.cjs +16 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -574,6 +574,13 @@ function translateDialect(sql) {
|
|
|
574
574
|
);
|
|
575
575
|
s = replaceFunction(s, "hex", (arg) => `encode(${arg}, 'hex')`);
|
|
576
576
|
s = replaceFunction(s, "randomblob", (arg) => `gen_random_bytes(${arg})`);
|
|
577
|
+
s = replaceFunction(s, "datetime", (arg) => {
|
|
578
|
+
const trimmed = arg.trim();
|
|
579
|
+
if (trimmed === "'now'" || trimmed === '"now"') return "NOW()";
|
|
580
|
+
throw new Error(
|
|
581
|
+
"PostgresAdapter: datetime(" + arg + ") is not auto-translated. Only datetime('now') is supported. Use NOW() or an equivalent Postgres expression in your migration."
|
|
582
|
+
);
|
|
583
|
+
});
|
|
577
584
|
return s;
|
|
578
585
|
}
|
|
579
586
|
function hasOnConflictInCode(sql) {
|
package/dist/index.cjs
CHANGED
|
@@ -324,6 +324,13 @@ function translateDialect(sql) {
|
|
|
324
324
|
);
|
|
325
325
|
s = replaceFunction(s, "hex", (arg) => `encode(${arg}, 'hex')`);
|
|
326
326
|
s = replaceFunction(s, "randomblob", (arg) => `gen_random_bytes(${arg})`);
|
|
327
|
+
s = replaceFunction(s, "datetime", (arg) => {
|
|
328
|
+
const trimmed = arg.trim();
|
|
329
|
+
if (trimmed === "'now'" || trimmed === '"now"') return "NOW()";
|
|
330
|
+
throw new Error(
|
|
331
|
+
"PostgresAdapter: datetime(" + arg + ") is not auto-translated. Only datetime('now') is supported. Use NOW() or an equivalent Postgres expression in your migration."
|
|
332
|
+
);
|
|
333
|
+
});
|
|
327
334
|
return s;
|
|
328
335
|
}
|
|
329
336
|
function hasOnConflictInCode(sql) {
|
package/dist/index.js
CHANGED
|
@@ -259,6 +259,13 @@ function translateDialect(sql) {
|
|
|
259
259
|
);
|
|
260
260
|
s = replaceFunction(s, "hex", (arg) => `encode(${arg}, 'hex')`);
|
|
261
261
|
s = replaceFunction(s, "randomblob", (arg) => `gen_random_bytes(${arg})`);
|
|
262
|
+
s = replaceFunction(s, "datetime", (arg) => {
|
|
263
|
+
const trimmed = arg.trim();
|
|
264
|
+
if (trimmed === "'now'" || trimmed === '"now"') return "NOW()";
|
|
265
|
+
throw new Error(
|
|
266
|
+
"PostgresAdapter: datetime(" + arg + ") is not auto-translated. Only datetime('now') is supported. Use NOW() or an equivalent Postgres expression in your migration."
|
|
267
|
+
);
|
|
268
|
+
});
|
|
262
269
|
return s;
|
|
263
270
|
}
|
|
264
271
|
function hasOnConflictInCode(sql) {
|
package/dist/postgres-worker.cjs
CHANGED
|
@@ -23,6 +23,22 @@ function ensureClient() {
|
|
|
23
23
|
extErr instanceof Error ? extErr.message : extErr
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
|
+
try {
|
|
27
|
+
await client.query(
|
|
28
|
+
`CREATE OR REPLACE FUNCTION json_extract(doc text, path text)
|
|
29
|
+
RETURNS text
|
|
30
|
+
LANGUAGE sql
|
|
31
|
+
IMMUTABLE
|
|
32
|
+
AS $fn$
|
|
33
|
+
SELECT doc::jsonb #>> string_to_array(regexp_replace(path, '^\\$\\.?', ''), '.')
|
|
34
|
+
$fn$;`
|
|
35
|
+
);
|
|
36
|
+
} catch (jeErr) {
|
|
37
|
+
console.warn(
|
|
38
|
+
"[PostgresAdapter] could not register json_extract polyfill:",
|
|
39
|
+
jeErr instanceof Error ? jeErr.message : jeErr
|
|
40
|
+
);
|
|
41
|
+
}
|
|
26
42
|
return { ok: true };
|
|
27
43
|
}
|
|
28
44
|
case "close": {
|
package/package.json
CHANGED