rake-db 2.8.30 → 2.8.31
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/index.d.ts +6 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -376,7 +376,12 @@ declare const rakeDb: <CT extends Record<string, orchid_core.AnyColumnTypeCreato
|
|
|
376
376
|
updatedAt: orchid_core.ColumnWithDefault<T_3, orchid_core.RawExpression>;
|
|
377
377
|
};
|
|
378
378
|
name: typeof orchid_core.name;
|
|
379
|
-
|
|
379
|
+
sql: {
|
|
380
|
+
(sql: TemplateStringsArray, ...values: unknown[]): orchid_core.RawExpression;
|
|
381
|
+
(sql: string): orchid_core.RawExpression;
|
|
382
|
+
(values: Record<string, unknown>, sql: string): orchid_core.RawExpression;
|
|
383
|
+
(values: Record<string, unknown>): (sql_0: TemplateStringsArray, ...sql_1: unknown[]) => orchid_core.RawExpression;
|
|
384
|
+
};
|
|
380
385
|
smallint(): pqb.SmallIntColumn;
|
|
381
386
|
integer(): pqb.IntegerColumn;
|
|
382
387
|
bigint(): pqb.BigIntColumn;
|
package/dist/index.js
CHANGED
|
@@ -3000,7 +3000,20 @@ const createView = (ast) => {
|
|
|
3000
3000
|
}
|
|
3001
3001
|
orchidCore.addCode(code, ", ");
|
|
3002
3002
|
if (!ast.sql.__values) {
|
|
3003
|
-
|
|
3003
|
+
const raw = ast.sql.__raw;
|
|
3004
|
+
let sql;
|
|
3005
|
+
if (typeof raw === "string") {
|
|
3006
|
+
sql = raw;
|
|
3007
|
+
} else {
|
|
3008
|
+
sql = "";
|
|
3009
|
+
const parts = raw[0];
|
|
3010
|
+
const last = parts.length - 1;
|
|
3011
|
+
for (let i = 0; i < last; i++) {
|
|
3012
|
+
sql += parts[i] + `\${${raw[i + 1]}}`;
|
|
3013
|
+
}
|
|
3014
|
+
sql += parts[last];
|
|
3015
|
+
}
|
|
3016
|
+
orchidCore.addCode(code, orchidCore.backtickQuote(sql));
|
|
3004
3017
|
} else {
|
|
3005
3018
|
orchidCore.addCode(code, orchidCore.rawToCode("db", ast.sql));
|
|
3006
3019
|
}
|