pqb 0.8.3 → 0.8.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # pqb
2
2
 
3
+ ## 0.8.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Add --code cli argument to rake-db
8
+ - Improve codegen
9
+
3
10
  ## 0.8.3
4
11
 
5
12
  ### Patch Changes
package/dist/index.esm.js CHANGED
@@ -2127,7 +2127,7 @@ const foreignKeyArgumentToCode = (foreignKey) => {
2127
2127
  } else {
2128
2128
  code.push(singleQuote(foreignKey.table));
2129
2129
  }
2130
- code.push(`, ${singleQuote(foreignKey.columns[0])}`);
2130
+ addCode(code, `, ${singleQuote(foreignKey.columns[0])}`);
2131
2131
  const hasOptions = foreignKey.name || foreignKey.match || foreignKey.onUpdate || foreignKey.onDelete;
2132
2132
  if (hasOptions) {
2133
2133
  const arr = [];
@@ -2139,7 +2139,9 @@ const foreignKeyArgumentToCode = (foreignKey) => {
2139
2139
  arr.push(`onUpdate: ${singleQuote(foreignKey.onUpdate)},`);
2140
2140
  if (foreignKey.onDelete)
2141
2141
  arr.push(`onDelete: ${singleQuote(foreignKey.onDelete)},`);
2142
- code.push(", {", arr, "}");
2142
+ addCode(code, ", {");
2143
+ code.push(arr);
2144
+ addCode(code, "}");
2143
2145
  }
2144
2146
  return code;
2145
2147
  };
@@ -2150,7 +2152,9 @@ const columnCode = (type, t, code) => {
2150
2152
  addCode(code, ".primaryKey()");
2151
2153
  if (foreignKey) {
2152
2154
  addCode(code, `.foreignKey(`);
2153
- addCode(code, foreignKeyArgumentToCode(foreignKey));
2155
+ for (const part of foreignKeyArgumentToCode(foreignKey)) {
2156
+ addCode(code, part);
2157
+ }
2154
2158
  addCode(code, ")");
2155
2159
  }
2156
2160
  if (type.isHidden)