pqb 0.47.4 → 0.47.5
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.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -563,7 +563,7 @@ const indexInnerToCode = (index, t) => {
|
|
|
563
563
|
if (columnsMultiline) {
|
|
564
564
|
const objects = [];
|
|
565
565
|
for (const column of index.columns) {
|
|
566
|
-
const expr = "
|
|
566
|
+
const expr = "expression" in column ? column.expression : column.column;
|
|
567
567
|
let hasOptions2 = false;
|
|
568
568
|
for (const key in column) {
|
|
569
569
|
if (key !== "column") {
|
|
@@ -574,7 +574,7 @@ const indexInnerToCode = (index, t) => {
|
|
|
574
574
|
objects.push(`${orchidCore.singleQuote(expr)},`);
|
|
575
575
|
} else {
|
|
576
576
|
const props = [
|
|
577
|
-
`${"
|
|
577
|
+
`${"expression" in column ? "expression" : "column"}: ${orchidCore.singleQuote(
|
|
578
578
|
expr
|
|
579
579
|
)},`
|
|
580
580
|
];
|
|
@@ -644,9 +644,11 @@ const excludeInnerToCode = (item, t) => {
|
|
|
644
644
|
const hasOptions = optionsKeys.some((key) => key && item.options[key]);
|
|
645
645
|
const objects = [];
|
|
646
646
|
for (const column of item.columns) {
|
|
647
|
-
const expr = "
|
|
647
|
+
const expr = "expression" in column ? column.expression : column.column;
|
|
648
648
|
const props = [
|
|
649
|
-
`${"
|
|
649
|
+
`${"expression" in column ? "expression" : "column"}: ${orchidCore.singleQuote(
|
|
650
|
+
expr
|
|
651
|
+
)},`
|
|
650
652
|
];
|
|
651
653
|
for (const key of columnOptions) {
|
|
652
654
|
const value = column[key];
|
|
@@ -768,12 +770,14 @@ const foreignKeyArgumentToCode = ({
|
|
|
768
770
|
const columnIndexesToCode = (items) => {
|
|
769
771
|
const code = [];
|
|
770
772
|
for (const { options, name } of items) {
|
|
771
|
-
orchidCore.addCode(
|
|
773
|
+
orchidCore.addCode(
|
|
774
|
+
code,
|
|
775
|
+
`.${options.unique ? "unique" : "index"}(${name ? `${orchidCore.singleQuote(name)}` : ""}`
|
|
776
|
+
);
|
|
772
777
|
const arr = [
|
|
773
778
|
options.collate && `collate: ${orchidCore.singleQuote(options.collate)},`,
|
|
774
779
|
options.opclass && `opclass: ${orchidCore.singleQuote(options.opclass)},`,
|
|
775
780
|
options.order && `order: ${orchidCore.singleQuote(options.order)},`,
|
|
776
|
-
name && `name: ${orchidCore.singleQuote(name)},`,
|
|
777
781
|
options.using && `using: ${orchidCore.singleQuote(options.using)},`,
|
|
778
782
|
options.include && `include: ${typeof options.include === "string" ? orchidCore.singleQuote(options.include) : `[${options.include.map(orchidCore.singleQuote).join(", ")}]`},`,
|
|
779
783
|
options.nullsNotDistinct && `nullsNotDistinct: true,`,
|
|
@@ -782,7 +786,7 @@ const columnIndexesToCode = (items) => {
|
|
|
782
786
|
options.where && `where: ${orchidCore.singleQuote(options.where)},`
|
|
783
787
|
].filter((x) => !!x);
|
|
784
788
|
if (arr.length) {
|
|
785
|
-
orchidCore.addCode(code, "{");
|
|
789
|
+
orchidCore.addCode(code, name ? `, {` : "{");
|
|
786
790
|
orchidCore.addCode(code, arr);
|
|
787
791
|
orchidCore.addCode(code, "}");
|
|
788
792
|
}
|