bun-query-builder 0.2.15 → 0.2.16

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/bin/cli.js CHANGED
@@ -28885,6 +28885,20 @@ function buildMigrationPlan2(models, options) {
28885
28885
  ensureTable({ table: pivotTable, columns: cols, indexes: idx });
28886
28886
  }
28887
28887
  }
28888
+ const tablesByName = new Map(tables.map((table) => [table.table, table]));
28889
+ for (const table of tables) {
28890
+ for (const column of table.columns) {
28891
+ if (!column.references)
28892
+ continue;
28893
+ const referenced = tablesByName.get(column.references.table)?.columns.find((candidate) => candidate.name === column.references.column);
28894
+ if (!referenced || column.type === referenced.type)
28895
+ continue;
28896
+ column.type = referenced.type;
28897
+ column.maxLength = referenced.maxLength;
28898
+ column.enumValues = referenced.enumValues;
28899
+ column.enumTypeName = referenced.enumTypeName;
28900
+ }
28901
+ }
28888
28902
  return { dialect: options.dialect, vitessSharded: options.vitessSharded, tables };
28889
28903
  }
28890
28904
  function generateSql(plan, opts = {}) {
@@ -31548,7 +31562,7 @@ function getPrefix() {
31548
31562
  }
31549
31563
  var prefix = getPrefix();
31550
31564
  // package.json
31551
- var version2 = "0.2.15";
31565
+ var version2 = "0.2.16";
31552
31566
 
31553
31567
  // bin/cli.ts
31554
31568
  init_actions();
package/dist/src/index.js CHANGED
@@ -28884,6 +28884,20 @@ function buildMigrationPlan2(models, options) {
28884
28884
  ensureTable({ table: pivotTable, columns: cols, indexes: idx });
28885
28885
  }
28886
28886
  }
28887
+ const tablesByName = new Map(tables.map((table) => [table.table, table]));
28888
+ for (const table of tables) {
28889
+ for (const column of table.columns) {
28890
+ if (!column.references)
28891
+ continue;
28892
+ const referenced = tablesByName.get(column.references.table)?.columns.find((candidate) => candidate.name === column.references.column);
28893
+ if (!referenced || column.type === referenced.type)
28894
+ continue;
28895
+ column.type = referenced.type;
28896
+ column.maxLength = referenced.maxLength;
28897
+ column.enumValues = referenced.enumValues;
28898
+ column.enumTypeName = referenced.enumTypeName;
28899
+ }
28900
+ }
28887
28901
  return { dialect: options.dialect, vitessSharded: options.vitessSharded, tables };
28888
28902
  }
28889
28903
  function generateSql(plan, opts = {}) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-query-builder",
3
3
  "type": "module",
4
- "version": "0.2.15",
4
+ "version": "0.2.16",
5
5
  "description": "A simple yet performant query builder for TypeScript. Built with Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",