drizzle-kit 0.30.1-c095ebc → 0.30.1-e6823b4

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.
Files changed (4) hide show
  1. package/api.js +22 -22
  2. package/api.mjs +22 -22
  3. package/bin.cjs +1 -1
  4. package/package.json +1 -1
package/api.js CHANGED
@@ -24999,14 +24999,20 @@ function relationsFilterToSQL(table5, filter2) {
24999
24999
  return and(...parts);
25000
25000
  }
25001
25001
  function relationsOrderToSQL(table5, orders) {
25002
- const data = typeof orders === "function" ? orders(table5[Columns], orderByOperators) : orders;
25003
- return is(data, SQL) ? data : Array.isArray(data) ? data.length ? sql.join(data.map((o) => is(o, SQL) ? o : asc(o)), sql`, `) : void 0 : asc(data);
25002
+ if (typeof orders === "function") {
25003
+ const data = orders(table5, orderByOperators);
25004
+ return is(data, SQL) ? data : Array.isArray(data) ? data.length ? sql.join(data.map((o) => is(o, SQL) ? o : asc(o)), sql`, `) : void 0 : is(data, Column2) ? asc(data) : void 0;
25005
+ }
25006
+ const entries = Object.entries(orders).filter(([_2, value]) => value);
25007
+ if (!entries.length)
25008
+ return void 0;
25009
+ return sql.join(entries.map(([column5, value]) => (value === "asc" ? asc : desc)(table5[Columns][column5])), sql`, `);
25004
25010
  }
25005
25011
  function relationExtrasToSQL(table5, extras) {
25006
25012
  const subqueries = [];
25007
25013
  const selection = [];
25008
25014
  for (const [key, extra] of Object.entries(
25009
- typeof extras === "function" ? extras(table5[Columns], { sql: operators.sql }) : extras
25015
+ typeof extras === "function" ? extras(table5, { sql: operators.sql }) : extras
25010
25016
  )) {
25011
25017
  if (!extra)
25012
25018
  continue;
@@ -25189,7 +25195,7 @@ Hint: you can specify "alias" on both sides of the relation with the same value`
25189
25195
  this.targetTable = targetTable;
25190
25196
  }
25191
25197
  };
25192
- __publicField(Relation, _a119, "Relation");
25198
+ __publicField(Relation, _a119, "RelationV2");
25193
25199
  One = class extends (_b95 = Relation, _a120 = entityKind, _b95) {
25194
25200
  constructor(targetTable, config) {
25195
25201
  super(targetTable);
@@ -25205,7 +25211,7 @@ Hint: you can specify "alias" on both sides of the relation with the same value`
25205
25211
  this.optional = config?.optional ?? false;
25206
25212
  }
25207
25213
  };
25208
- __publicField(One, _a120, "One");
25214
+ __publicField(One, _a120, "OneV2");
25209
25215
  Many = class extends (_b96 = Relation, _a121 = entityKind, _b96) {
25210
25216
  constructor(targetTable, config) {
25211
25217
  super(targetTable);
@@ -25220,7 +25226,7 @@ Hint: you can specify "alias" on both sides of the relation with the same value`
25220
25226
  }
25221
25227
  }
25222
25228
  };
25223
- __publicField(Many, _a121, "Many");
25229
+ __publicField(Many, _a121, "ManyV2");
25224
25230
  _a122 = entityKind;
25225
25231
  AggregatedField = class {
25226
25232
  constructor() {
@@ -26070,11 +26076,9 @@ var init_dialect = __esm({
26070
26076
  const columnIdentifiers = [];
26071
26077
  let colSelectionMode;
26072
26078
  for (const [k, v] of entries) {
26073
- if (colSelectionMode === void 0)
26074
- colSelectionMode = v;
26075
- else if (v !== void 0 && colSelectionMode !== v) {
26076
- throw new Error("Columns cannot be both true and false at the same time");
26077
- }
26079
+ if (v === void 0)
26080
+ continue;
26081
+ colSelectionMode = colSelectionMode || v;
26078
26082
  if (v) {
26079
26083
  columnIdentifiers.push(
26080
26084
  sql`${table5[Columns][k]} as ${sql.identifier(k)}`
@@ -32211,11 +32215,9 @@ var init_dialect2 = __esm({
32211
32215
  const entries = Object.entries(columns);
32212
32216
  let colSelectionMode;
32213
32217
  for (const [k, v] of entries) {
32214
- if (colSelectionMode === void 0)
32215
- colSelectionMode = v;
32216
- else if (v !== void 0 && colSelectionMode !== v) {
32217
- throw new Error("Columns cannot be both true and false at the same time");
32218
- }
32218
+ if (v === void 0)
32219
+ continue;
32220
+ colSelectionMode = colSelectionMode || v;
32219
32221
  if (v) {
32220
32222
  selectedColumns.push({
32221
32223
  column: table5[Columns][k],
@@ -32831,7 +32833,7 @@ var init_dialect2 = __esm({
32831
32833
  }
32832
32834
  const relation = tableConfig.relations[k];
32833
32835
  const isSingle2 = is(relation, One);
32834
- const targetTable = relation.targetTable;
32836
+ const targetTable = aliasedTable(relation.targetTable, `d${currentDepth + 1}`);
32835
32837
  const relationFilter = relationToSQL(relation, table5, targetTable);
32836
32838
  const innerQuery = this.buildRelationalQuery({
32837
32839
  table: targetTable,
@@ -37713,11 +37715,9 @@ var init_dialect3 = __esm({
37713
37715
  const entries = Object.entries(columns);
37714
37716
  let colSelectionMode;
37715
37717
  for (const [k, v] of entries) {
37716
- if (colSelectionMode === void 0)
37717
- colSelectionMode = v;
37718
- else if (v !== void 0 && colSelectionMode !== v) {
37719
- throw new Error("Columns cannot be both true and false at the same time");
37720
- }
37718
+ if (v === void 0)
37719
+ continue;
37720
+ colSelectionMode = colSelectionMode || v;
37721
37721
  if (v) {
37722
37722
  selectedColumns.push({
37723
37723
  column: table5[Columns][k],
package/api.mjs CHANGED
@@ -25004,14 +25004,20 @@ function relationsFilterToSQL(table5, filter2) {
25004
25004
  return and(...parts);
25005
25005
  }
25006
25006
  function relationsOrderToSQL(table5, orders) {
25007
- const data = typeof orders === "function" ? orders(table5[Columns], orderByOperators) : orders;
25008
- return is(data, SQL) ? data : Array.isArray(data) ? data.length ? sql.join(data.map((o) => is(o, SQL) ? o : asc(o)), sql`, `) : void 0 : asc(data);
25007
+ if (typeof orders === "function") {
25008
+ const data = orders(table5, orderByOperators);
25009
+ return is(data, SQL) ? data : Array.isArray(data) ? data.length ? sql.join(data.map((o) => is(o, SQL) ? o : asc(o)), sql`, `) : void 0 : is(data, Column2) ? asc(data) : void 0;
25010
+ }
25011
+ const entries = Object.entries(orders).filter(([_2, value]) => value);
25012
+ if (!entries.length)
25013
+ return void 0;
25014
+ return sql.join(entries.map(([column5, value]) => (value === "asc" ? asc : desc)(table5[Columns][column5])), sql`, `);
25009
25015
  }
25010
25016
  function relationExtrasToSQL(table5, extras) {
25011
25017
  const subqueries = [];
25012
25018
  const selection = [];
25013
25019
  for (const [key, extra] of Object.entries(
25014
- typeof extras === "function" ? extras(table5[Columns], { sql: operators.sql }) : extras
25020
+ typeof extras === "function" ? extras(table5, { sql: operators.sql }) : extras
25015
25021
  )) {
25016
25022
  if (!extra)
25017
25023
  continue;
@@ -25194,7 +25200,7 @@ Hint: you can specify "alias" on both sides of the relation with the same value`
25194
25200
  this.targetTable = targetTable;
25195
25201
  }
25196
25202
  };
25197
- __publicField(Relation, _a119, "Relation");
25203
+ __publicField(Relation, _a119, "RelationV2");
25198
25204
  One = class extends (_b95 = Relation, _a120 = entityKind, _b95) {
25199
25205
  constructor(targetTable, config) {
25200
25206
  super(targetTable);
@@ -25210,7 +25216,7 @@ Hint: you can specify "alias" on both sides of the relation with the same value`
25210
25216
  this.optional = config?.optional ?? false;
25211
25217
  }
25212
25218
  };
25213
- __publicField(One, _a120, "One");
25219
+ __publicField(One, _a120, "OneV2");
25214
25220
  Many = class extends (_b96 = Relation, _a121 = entityKind, _b96) {
25215
25221
  constructor(targetTable, config) {
25216
25222
  super(targetTable);
@@ -25225,7 +25231,7 @@ Hint: you can specify "alias" on both sides of the relation with the same value`
25225
25231
  }
25226
25232
  }
25227
25233
  };
25228
- __publicField(Many, _a121, "Many");
25234
+ __publicField(Many, _a121, "ManyV2");
25229
25235
  _a122 = entityKind;
25230
25236
  AggregatedField = class {
25231
25237
  constructor() {
@@ -26075,11 +26081,9 @@ var init_dialect = __esm({
26075
26081
  const columnIdentifiers = [];
26076
26082
  let colSelectionMode;
26077
26083
  for (const [k, v] of entries) {
26078
- if (colSelectionMode === void 0)
26079
- colSelectionMode = v;
26080
- else if (v !== void 0 && colSelectionMode !== v) {
26081
- throw new Error("Columns cannot be both true and false at the same time");
26082
- }
26084
+ if (v === void 0)
26085
+ continue;
26086
+ colSelectionMode = colSelectionMode || v;
26083
26087
  if (v) {
26084
26088
  columnIdentifiers.push(
26085
26089
  sql`${table5[Columns][k]} as ${sql.identifier(k)}`
@@ -32216,11 +32220,9 @@ var init_dialect2 = __esm({
32216
32220
  const entries = Object.entries(columns);
32217
32221
  let colSelectionMode;
32218
32222
  for (const [k, v] of entries) {
32219
- if (colSelectionMode === void 0)
32220
- colSelectionMode = v;
32221
- else if (v !== void 0 && colSelectionMode !== v) {
32222
- throw new Error("Columns cannot be both true and false at the same time");
32223
- }
32223
+ if (v === void 0)
32224
+ continue;
32225
+ colSelectionMode = colSelectionMode || v;
32224
32226
  if (v) {
32225
32227
  selectedColumns.push({
32226
32228
  column: table5[Columns][k],
@@ -32836,7 +32838,7 @@ var init_dialect2 = __esm({
32836
32838
  }
32837
32839
  const relation = tableConfig.relations[k];
32838
32840
  const isSingle2 = is(relation, One);
32839
- const targetTable = relation.targetTable;
32841
+ const targetTable = aliasedTable(relation.targetTable, `d${currentDepth + 1}`);
32840
32842
  const relationFilter = relationToSQL(relation, table5, targetTable);
32841
32843
  const innerQuery = this.buildRelationalQuery({
32842
32844
  table: targetTable,
@@ -37718,11 +37720,9 @@ var init_dialect3 = __esm({
37718
37720
  const entries = Object.entries(columns);
37719
37721
  let colSelectionMode;
37720
37722
  for (const [k, v] of entries) {
37721
- if (colSelectionMode === void 0)
37722
- colSelectionMode = v;
37723
- else if (v !== void 0 && colSelectionMode !== v) {
37724
- throw new Error("Columns cannot be both true and false at the same time");
37725
- }
37723
+ if (v === void 0)
37724
+ continue;
37725
+ colSelectionMode = colSelectionMode || v;
37726
37726
  if (v) {
37727
37727
  selectedColumns.push({
37728
37728
  column: table5[Columns][k],
package/bin.cjs CHANGED
@@ -92611,7 +92611,7 @@ init_utils5();
92611
92611
  var version2 = async () => {
92612
92612
  const { npmVersion } = await ormCoreVersions();
92613
92613
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
92614
- const envVersion = "0.30.1-c095ebc";
92614
+ const envVersion = "0.30.1-e6823b4";
92615
92615
  const kitVersion = envVersion ? `v${envVersion}` : "--";
92616
92616
  const versions = `drizzle-kit: ${kitVersion}
92617
92617
  ${ormVersion}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.30.1-c095ebc",
3
+ "version": "0.30.1-e6823b4",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",