bun-query-builder 0.2.6 → 0.2.8

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
@@ -11701,6 +11701,9 @@ function applyConfig(userConfig) {
11701
11701
  if (userConfig.softDeletes) {
11702
11702
  config5.softDeletes = { ...config5.softDeletes, ...userConfig.softDeletes };
11703
11703
  }
11704
+ if (userConfig.vitess) {
11705
+ config5.vitess = { ...config5.vitess, ...userConfig.vitess };
11706
+ }
11704
11707
  }
11705
11708
  function setConfig(userConfig) {
11706
11709
  if (userConfig.dialect && _lastConfiguredDialect && userConfig.dialect !== _lastConfiguredDialect) {
@@ -11722,6 +11725,7 @@ var init_config = __esm(() => {
11722
11725
  defaultConfig4 = {
11723
11726
  verbose: true,
11724
11727
  snapshotDir: ".qb",
11728
+ migrationDir: "database/migrations",
11725
11729
  dialect: "postgres",
11726
11730
  database: {
11727
11731
  database: "test_db",
@@ -11730,6 +11734,9 @@ var init_config = __esm(() => {
11730
11734
  host: "localhost",
11731
11735
  port: 5432
11732
11736
  },
11737
+ vitess: {
11738
+ sharded: true
11739
+ },
11733
11740
  timestamps: {
11734
11741
  createdAt: "created_at",
11735
11742
  updatedAt: "updated_at",
@@ -17970,7 +17977,7 @@ function parseMysqlEnum(columnType) {
17970
17977
  return;
17971
17978
  return m[1].split(",").map((s) => s.trim().replace(/^'(.*)'$/s, "$1").replace(/''/g, "'")).filter((s) => s.length > 0);
17972
17979
  }
17973
- function groupPhysicalIndexes(table, rows) {
17980
+ function groupPhysicalIndexes(_table, rows) {
17974
17981
  const byName = new Map;
17975
17982
  for (const r of rows) {
17976
17983
  if (r.isPrimary)
@@ -18531,11 +18538,16 @@ var VitessDriver;
18531
18538
  var init_vitess = __esm(() => {
18532
18539
  init_mysql();
18533
18540
  VitessDriver = class VitessDriver extends MySQLDriver {
18534
- getAutoIncrementClause(_column) {
18535
- return "";
18541
+ sharded;
18542
+ constructor(sharded = true) {
18543
+ super();
18544
+ this.sharded = sharded;
18545
+ }
18546
+ getAutoIncrementClause(column) {
18547
+ return this.sharded ? "" : super.getAutoIncrementClause(column);
18536
18548
  }
18537
18549
  renderColumn(column) {
18538
- if (!column.references)
18550
+ if (!this.sharded || !column.references)
18539
18551
  return super.renderColumn(column);
18540
18552
  const { references: _references, ...withoutReference } = column;
18541
18553
  return super.renderColumn(withoutReference);
@@ -18543,10 +18555,12 @@ var init_vitess = __esm(() => {
18543
18555
  createTable(table) {
18544
18556
  return super.createTable(table);
18545
18557
  }
18546
- addForeignKey() {
18547
- return "";
18558
+ addForeignKey(...args) {
18559
+ return this.sharded ? "" : super.addForeignKey(...args);
18548
18560
  }
18549
18561
  createMigrationsTable() {
18562
+ if (!this.sharded)
18563
+ return super.createMigrationsTable();
18550
18564
  return `CREATE TABLE IF NOT EXISTS migrations (
18551
18565
  migration VARCHAR(255) NOT NULL PRIMARY KEY,
18552
18566
  executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
@@ -18767,7 +18781,7 @@ function getDialectDriver(dialect) {
18767
18781
  case "singlestore":
18768
18782
  return new SingleStoreDriver;
18769
18783
  case "vitess":
18770
- return new VitessDriver;
18784
+ return new VitessDriver(config5.vitess?.sharded ?? true);
18771
18785
  case "sqlite":
18772
18786
  return new SQLiteDriver;
18773
18787
  default:
@@ -18775,6 +18789,7 @@ function getDialectDriver(dialect) {
18775
18789
  }
18776
18790
  }
18777
18791
  var init_drivers = __esm(() => {
18792
+ init_config();
18778
18793
  init_mysql();
18779
18794
  init_postgres();
18780
18795
  init_singlestore();
@@ -18789,7 +18804,7 @@ var init_drivers = __esm(() => {
18789
18804
 
18790
18805
  // src/workspace.ts
18791
18806
  import { existsSync as existsSync16 } from "fs";
18792
- import { dirname as dirname8, join as join9 } from "path";
18807
+ import { dirname as dirname8, isAbsolute as isAbsolute3, join as join9 } from "path";
18793
18808
  import process24 from "process";
18794
18809
  function findWorkspaceRoot2(startPath = process24.cwd()) {
18795
18810
  let currentPath = startPath;
@@ -18800,8 +18815,9 @@ function findWorkspaceRoot2(startPath = process24.cwd()) {
18800
18815
  }
18801
18816
  return process24.cwd();
18802
18817
  }
18803
- function getSqlDirectory(workspaceRoot) {
18804
- return join9(workspaceRoot ?? findWorkspaceRoot2(), "database", "migrations");
18818
+ function getSqlDirectory(workspaceRoot, migrationDir = "database/migrations") {
18819
+ const configured = migrationDir || "database/migrations";
18820
+ return isAbsolute3(configured) ? configured : join9(workspaceRoot ?? findWorkspaceRoot2(), configured);
18805
18821
  }
18806
18822
  var init_workspace = () => {};
18807
18823
 
@@ -18910,7 +18926,7 @@ function getWorkspaceRoot() {
18910
18926
  return findWorkspaceRoot2();
18911
18927
  }
18912
18928
  function ensureSqlDirectory(workspaceRoot) {
18913
- const sqlDir = getSqlDirectory(workspaceRoot);
18929
+ const sqlDir = getSqlDirectory(workspaceRoot, config5.migrationDir);
18914
18930
  if (!existsSync17(sqlDir)) {
18915
18931
  mkdirSync8(sqlDir, { recursive: true });
18916
18932
  info(`-- Created SQL directory: ${sqlDir}`);
@@ -19163,7 +19179,7 @@ async function deleteMigrationFiles(dir, workspaceRoot, opts = {}) {
19163
19179
  unlinkSync(statePath);
19164
19180
  info(`-- Removed legacy migration state file: ${statePath}`);
19165
19181
  }
19166
- removeGeneratedMigrationFiles(getSqlDirectory(workspaceRoot));
19182
+ removeGeneratedMigrationFiles(getSqlDirectory(workspaceRoot, config5.migrationDir));
19167
19183
  }
19168
19184
  function removeGeneratedMigrationFiles(sqlDir) {
19169
19185
  if (!existsSync17(sqlDir))
@@ -19358,7 +19374,7 @@ async function migrateRollback(options = {}) {
19358
19374
  console.log(` - ${migration.migration}`);
19359
19375
  }
19360
19376
  console.log();
19361
- const sqlDir = getSqlDirectory();
19377
+ const sqlDir = getSqlDirectory(undefined, config5.migrationDir);
19362
19378
  let reversedAny = false;
19363
19379
  for (const migration of migrationsToRollback) {
19364
19380
  try {
@@ -19408,7 +19424,7 @@ import { existsSync as existsSync19, readdirSync as readdirSync8 } from "fs";
19408
19424
  async function migrateStatus() {
19409
19425
  const dialect = config5.dialect || "postgres";
19410
19426
  const driver = getDialectDriver(dialect);
19411
- const sqlDir = getSqlDirectory();
19427
+ const sqlDir = getSqlDirectory(undefined, config5.migrationDir);
19412
19428
  console.log("-- Migration Status");
19413
19429
  console.log(`-- Dialect: ${dialect}`);
19414
19430
  console.log(`-- SQL directory: ${sqlDir}`);
@@ -28103,7 +28119,7 @@ var init_factory = () => {};
28103
28119
 
28104
28120
  // src/loader.ts
28105
28121
  import { readdirSync as readdirSync12 } from "fs";
28106
- import { basename, extname as extname4, isAbsolute as isAbsolute3, join as join17 } from "path";
28122
+ import { basename, extname as extname4, isAbsolute as isAbsolute5, join as join17 } from "path";
28107
28123
  import process30 from "process";
28108
28124
  function isModelFile(name) {
28109
28125
  const ext = extname4(name);
@@ -28136,7 +28152,7 @@ function collectModelFiles(dir) {
28136
28152
  }
28137
28153
  async function loadModels(options) {
28138
28154
  const cwd = options.cwd ?? process30.cwd();
28139
- const dir = isAbsolute3(options.modelsDir) ? options.modelsDir : join17(cwd, options.modelsDir);
28155
+ const dir = isAbsolute5(options.modelsDir) ? options.modelsDir : join17(cwd, options.modelsDir);
28140
28156
  const result = {};
28141
28157
  for (const full of collectModelFiles(dir)) {
28142
28158
  const cacheBuster = `?t=${Date.now()}-${Math.random().toString(36).slice(2)}`;
@@ -28270,7 +28286,7 @@ function findWorkspaceRoot5(startPath) {
28270
28286
  }
28271
28287
  function ensureSqlDirectory2() {
28272
28288
  const workspaceRoot = findWorkspaceRoot5(process31.cwd());
28273
- const sqlDir = join18(workspaceRoot, "database", "migrations");
28289
+ const sqlDir = getSqlDirectory(workspaceRoot, config5.migrationDir);
28274
28290
  if (!existsSync23(sqlDir)) {
28275
28291
  mkdirSync10(sqlDir, { recursive: true });
28276
28292
  info2(`-- Created SQL directory: ${sqlDir}`);
@@ -29272,7 +29288,7 @@ function generateDiffOperations(previous, next, opts = {}) {
29272
29288
  if (preserveUnknownColumns && removedCols.length > 0) {
29273
29289
  const preserved = removedCols.map((name) => prevCols[name]);
29274
29290
  const preservedNames = new Set(removedCols);
29275
- const keptIndexes = prev.indexes.filter((idx) => idx.columns.some((c2) => preservedNames.has(c2)) && !currIdx[indexKey(idx)]);
29291
+ const keptIndexes = prev.indexes.filter((idx) => idx.columns.some((c2) => preservedNames.has(c2)) && !currIdx[indexKey(idx, prev.table)]);
29276
29292
  info2(`-- Keeping ${preserved.length} column(s) on "${curr.table}" no model declares: ${removedCols.join(", ")} \u2014 reconciled from the database, where an undeclared column is out of scope rather than removed`);
29277
29293
  curr = { ...curr, columns: [...curr.columns, ...preserved], indexes: [...curr.indexes, ...keptIndexes] };
29278
29294
  currCols = mapColumnsByName(curr.columns);
@@ -29432,6 +29448,7 @@ var init_migrations = __esm(() => {
29432
29448
  init_drivers();
29433
29449
  init_sqlite();
29434
29450
  init_meta();
29451
+ init_workspace();
29435
29452
  createdMigrationFiles = [];
29436
29453
  });
29437
29454
 
@@ -31514,7 +31531,7 @@ function getPrefix() {
31514
31531
  }
31515
31532
  var prefix = getPrefix();
31516
31533
  // package.json
31517
- var version2 = "0.2.6";
31534
+ var version2 = "0.2.8";
31518
31535
 
31519
31536
  // bin/cli.ts
31520
31537
  init_actions();
@@ -6,8 +6,10 @@ import type { ColumnPlan, TablePlan } from '../migrations';
6
6
  * Vitess shards MySQL behind vtgate, which speaks the MySQL wire protocol, so
7
7
  * runtime DML (placeholders, backtick quoting, `ON DUPLICATE KEY UPDATE`,
8
8
  * `LAST_INSERT_ID`) is identical — see `isMysqlLike` in `config.ts`. Only DDL
9
- * diverges, and every divergence below follows from one fact: a keyspace is
10
- * split across shards that share nothing.
9
+ * diverges only when the keyspace is sharded. An unsharded keyspace retains
10
+ * normal MySQL AUTO_INCREMENT and foreign-key support, so this driver takes
11
+ * the topology explicitly instead of conflating "behind vtgate" with
12
+ * "distributed across shards".
11
13
  *
12
14
  * - **No foreign keys.** Enforcing one would need a cross-shard read on every
13
15
  * write, so vtgate rejects them in a sharded keyspace. Both forms are
@@ -30,9 +32,10 @@ import type { ColumnPlan, TablePlan } from '../migrations';
30
32
  * driver needs to know how a table is sharded.
31
33
  */
32
34
  export declare class VitessDriver extends MySQLDriver {
33
- protected getAutoIncrementClause(_column: ColumnPlan): string;
35
+ constructor(sharded?: boolean);
36
+ protected getAutoIncrementClause(column: ColumnPlan): string;
34
37
  protected renderColumn(column: ColumnPlan): string;
35
38
  createTable(table: TablePlan): string;
36
- addForeignKey(): string;
39
+ addForeignKey(...args: Parameters<MySQLDriver['addForeignKey']>): string;
37
40
  createMigrationsTable(): string;
38
41
  }
package/dist/src/index.js CHANGED
@@ -11700,6 +11700,9 @@ function applyConfig(userConfig) {
11700
11700
  if (userConfig.softDeletes) {
11701
11701
  config5.softDeletes = { ...config5.softDeletes, ...userConfig.softDeletes };
11702
11702
  }
11703
+ if (userConfig.vitess) {
11704
+ config5.vitess = { ...config5.vitess, ...userConfig.vitess };
11705
+ }
11703
11706
  }
11704
11707
  function setConfig(userConfig) {
11705
11708
  if (userConfig.dialect && _lastConfiguredDialect && userConfig.dialect !== _lastConfiguredDialect) {
@@ -11721,6 +11724,7 @@ var init_config = __esm(() => {
11721
11724
  defaultConfig4 = {
11722
11725
  verbose: true,
11723
11726
  snapshotDir: ".qb",
11727
+ migrationDir: "database/migrations",
11724
11728
  dialect: "postgres",
11725
11729
  database: {
11726
11730
  database: "test_db",
@@ -11729,6 +11733,9 @@ var init_config = __esm(() => {
11729
11733
  host: "localhost",
11730
11734
  port: 5432
11731
11735
  },
11736
+ vitess: {
11737
+ sharded: true
11738
+ },
11732
11739
  timestamps: {
11733
11740
  createdAt: "created_at",
11734
11741
  updatedAt: "updated_at",
@@ -17969,7 +17976,7 @@ function parseMysqlEnum(columnType) {
17969
17976
  return;
17970
17977
  return m[1].split(",").map((s) => s.trim().replace(/^'(.*)'$/s, "$1").replace(/''/g, "'")).filter((s) => s.length > 0);
17971
17978
  }
17972
- function groupPhysicalIndexes(table, rows) {
17979
+ function groupPhysicalIndexes(_table, rows) {
17973
17980
  const byName = new Map;
17974
17981
  for (const r of rows) {
17975
17982
  if (r.isPrimary)
@@ -18530,11 +18537,16 @@ var VitessDriver;
18530
18537
  var init_vitess = __esm(() => {
18531
18538
  init_mysql();
18532
18539
  VitessDriver = class VitessDriver extends MySQLDriver {
18533
- getAutoIncrementClause(_column) {
18534
- return "";
18540
+ sharded;
18541
+ constructor(sharded = true) {
18542
+ super();
18543
+ this.sharded = sharded;
18544
+ }
18545
+ getAutoIncrementClause(column) {
18546
+ return this.sharded ? "" : super.getAutoIncrementClause(column);
18535
18547
  }
18536
18548
  renderColumn(column) {
18537
- if (!column.references)
18549
+ if (!this.sharded || !column.references)
18538
18550
  return super.renderColumn(column);
18539
18551
  const { references: _references, ...withoutReference } = column;
18540
18552
  return super.renderColumn(withoutReference);
@@ -18542,10 +18554,12 @@ var init_vitess = __esm(() => {
18542
18554
  createTable(table) {
18543
18555
  return super.createTable(table);
18544
18556
  }
18545
- addForeignKey() {
18546
- return "";
18557
+ addForeignKey(...args) {
18558
+ return this.sharded ? "" : super.addForeignKey(...args);
18547
18559
  }
18548
18560
  createMigrationsTable() {
18561
+ if (!this.sharded)
18562
+ return super.createMigrationsTable();
18549
18563
  return `CREATE TABLE IF NOT EXISTS migrations (
18550
18564
  migration VARCHAR(255) NOT NULL PRIMARY KEY,
18551
18565
  executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
@@ -18766,7 +18780,7 @@ function getDialectDriver(dialect) {
18766
18780
  case "singlestore":
18767
18781
  return new SingleStoreDriver;
18768
18782
  case "vitess":
18769
- return new VitessDriver;
18783
+ return new VitessDriver(config5.vitess?.sharded ?? true);
18770
18784
  case "sqlite":
18771
18785
  return new SQLiteDriver;
18772
18786
  default:
@@ -18774,6 +18788,7 @@ function getDialectDriver(dialect) {
18774
18788
  }
18775
18789
  }
18776
18790
  var init_drivers = __esm(() => {
18791
+ init_config();
18777
18792
  init_mysql();
18778
18793
  init_postgres();
18779
18794
  init_singlestore();
@@ -18788,7 +18803,7 @@ var init_drivers = __esm(() => {
18788
18803
 
18789
18804
  // src/workspace.ts
18790
18805
  import { existsSync as existsSync16 } from "fs";
18791
- import { dirname as dirname8, join as join9 } from "path";
18806
+ import { dirname as dirname8, isAbsolute as isAbsolute3, join as join9 } from "path";
18792
18807
  import process24 from "process";
18793
18808
  function findWorkspaceRoot2(startPath = process24.cwd()) {
18794
18809
  let currentPath = startPath;
@@ -18799,8 +18814,9 @@ function findWorkspaceRoot2(startPath = process24.cwd()) {
18799
18814
  }
18800
18815
  return process24.cwd();
18801
18816
  }
18802
- function getSqlDirectory(workspaceRoot) {
18803
- return join9(workspaceRoot ?? findWorkspaceRoot2(), "database", "migrations");
18817
+ function getSqlDirectory(workspaceRoot, migrationDir = "database/migrations") {
18818
+ const configured = migrationDir || "database/migrations";
18819
+ return isAbsolute3(configured) ? configured : join9(workspaceRoot ?? findWorkspaceRoot2(), configured);
18804
18820
  }
18805
18821
  var init_workspace = () => {};
18806
18822
 
@@ -18909,7 +18925,7 @@ function getWorkspaceRoot() {
18909
18925
  return findWorkspaceRoot2();
18910
18926
  }
18911
18927
  function ensureSqlDirectory(workspaceRoot) {
18912
- const sqlDir = getSqlDirectory(workspaceRoot);
18928
+ const sqlDir = getSqlDirectory(workspaceRoot, config5.migrationDir);
18913
18929
  if (!existsSync17(sqlDir)) {
18914
18930
  mkdirSync8(sqlDir, { recursive: true });
18915
18931
  info(`-- Created SQL directory: ${sqlDir}`);
@@ -19162,7 +19178,7 @@ async function deleteMigrationFiles(dir, workspaceRoot, opts = {}) {
19162
19178
  unlinkSync(statePath);
19163
19179
  info(`-- Removed legacy migration state file: ${statePath}`);
19164
19180
  }
19165
- removeGeneratedMigrationFiles(getSqlDirectory(workspaceRoot));
19181
+ removeGeneratedMigrationFiles(getSqlDirectory(workspaceRoot, config5.migrationDir));
19166
19182
  }
19167
19183
  function removeGeneratedMigrationFiles(sqlDir) {
19168
19184
  if (!existsSync17(sqlDir))
@@ -19357,7 +19373,7 @@ async function migrateRollback(options = {}) {
19357
19373
  console.log(` - ${migration.migration}`);
19358
19374
  }
19359
19375
  console.log();
19360
- const sqlDir = getSqlDirectory();
19376
+ const sqlDir = getSqlDirectory(undefined, config5.migrationDir);
19361
19377
  let reversedAny = false;
19362
19378
  for (const migration of migrationsToRollback) {
19363
19379
  try {
@@ -19407,7 +19423,7 @@ import { existsSync as existsSync19, readdirSync as readdirSync8 } from "fs";
19407
19423
  async function migrateStatus() {
19408
19424
  const dialect = config5.dialect || "postgres";
19409
19425
  const driver = getDialectDriver(dialect);
19410
- const sqlDir = getSqlDirectory();
19426
+ const sqlDir = getSqlDirectory(undefined, config5.migrationDir);
19411
19427
  console.log("-- Migration Status");
19412
19428
  console.log(`-- Dialect: ${dialect}`);
19413
19429
  console.log(`-- SQL directory: ${sqlDir}`);
@@ -28102,7 +28118,7 @@ var init_factory = () => {};
28102
28118
 
28103
28119
  // src/loader.ts
28104
28120
  import { readdirSync as readdirSync12 } from "fs";
28105
- import { basename, extname as extname4, isAbsolute as isAbsolute3, join as join17 } from "path";
28121
+ import { basename, extname as extname4, isAbsolute as isAbsolute5, join as join17 } from "path";
28106
28122
  import process30 from "process";
28107
28123
  function isModelFile(name) {
28108
28124
  const ext = extname4(name);
@@ -28135,7 +28151,7 @@ function collectModelFiles(dir) {
28135
28151
  }
28136
28152
  async function loadModels(options) {
28137
28153
  const cwd = options.cwd ?? process30.cwd();
28138
- const dir = isAbsolute3(options.modelsDir) ? options.modelsDir : join17(cwd, options.modelsDir);
28154
+ const dir = isAbsolute5(options.modelsDir) ? options.modelsDir : join17(cwd, options.modelsDir);
28139
28155
  const result = {};
28140
28156
  for (const full of collectModelFiles(dir)) {
28141
28157
  const cacheBuster = `?t=${Date.now()}-${Math.random().toString(36).slice(2)}`;
@@ -28269,7 +28285,7 @@ function findWorkspaceRoot5(startPath) {
28269
28285
  }
28270
28286
  function ensureSqlDirectory2() {
28271
28287
  const workspaceRoot = findWorkspaceRoot5(process31.cwd());
28272
- const sqlDir = join18(workspaceRoot, "database", "migrations");
28288
+ const sqlDir = getSqlDirectory(workspaceRoot, config5.migrationDir);
28273
28289
  if (!existsSync23(sqlDir)) {
28274
28290
  mkdirSync10(sqlDir, { recursive: true });
28275
28291
  info2(`-- Created SQL directory: ${sqlDir}`);
@@ -29271,7 +29287,7 @@ function generateDiffOperations(previous, next, opts = {}) {
29271
29287
  if (preserveUnknownColumns && removedCols.length > 0) {
29272
29288
  const preserved = removedCols.map((name) => prevCols[name]);
29273
29289
  const preservedNames = new Set(removedCols);
29274
- const keptIndexes = prev.indexes.filter((idx) => idx.columns.some((c2) => preservedNames.has(c2)) && !currIdx[indexKey(idx)]);
29290
+ const keptIndexes = prev.indexes.filter((idx) => idx.columns.some((c2) => preservedNames.has(c2)) && !currIdx[indexKey(idx, prev.table)]);
29275
29291
  info2(`-- Keeping ${preserved.length} column(s) on "${curr.table}" no model declares: ${removedCols.join(", ")} \u2014 reconciled from the database, where an undeclared column is out of scope rather than removed`);
29276
29292
  curr = { ...curr, columns: [...curr.columns, ...preserved], indexes: [...curr.indexes, ...keptIndexes] };
29277
29293
  currCols = mapColumnsByName(curr.columns);
@@ -29431,6 +29447,7 @@ var init_migrations = __esm(() => {
29431
29447
  init_drivers();
29432
29448
  init_sqlite();
29433
29449
  init_meta();
29450
+ init_workspace();
29434
29451
  createdMigrationFiles = [];
29435
29452
  });
29436
29453
 
package/dist/types.d.ts CHANGED
@@ -192,6 +192,10 @@ export declare interface DatabaseConfig {
192
192
  ssl?: boolean
193
193
  pool?: PoolConfig
194
194
  }
195
+ /** Vitess topology controls that affect generated DDL. */
196
+ export declare interface VitessConfig {
197
+ sharded: boolean
198
+ }
195
199
  /**
196
200
  * # `BrowserConfig`
197
201
  *
@@ -226,6 +230,7 @@ export declare interface BrowserConfig {
226
230
  export declare interface QueryBuilderConfig {
227
231
  verbose: boolean
228
232
  snapshotDir: string
233
+ migrationDir: string
229
234
  dialect: SupportedDialect
230
235
  database: DatabaseConfig
231
236
  browser?: BrowserConfig
@@ -236,6 +241,7 @@ export declare interface QueryBuilderConfig {
236
241
  transactionDefaults: TransactionDefaultsConfig
237
242
  sql: SqlConfig
238
243
  sqlite?: SqliteConfig
244
+ vitess?: VitessConfig
239
245
  features: FeatureToggles
240
246
  debug?: {
241
247
  captureText: boolean
@@ -293,10 +299,10 @@ export declare interface UnsafeOptions {
293
299
  * but its DDL adds distributed-table concepts (`SHARD KEY`, `SORT KEY`,
294
300
  * `ROWSTORE`/columnstore) and drops foreign keys — handled by the dedicated
295
301
  * `SingleStoreDriver`.
296
- * - 'vitess': Sharded MySQL behind vtgate. Shares MySQL's wire protocol and
297
- * DML (see `isMysqlLike`), but a sharded keyspace rejects foreign keys and
298
- * AUTO_INCREMENT, and its sharding topology lives in a separate VSchema
299
- * document rather than in DDL — handled by the dedicated `VitessDriver`.
302
+ * - 'vitess': MySQL behind vtgate. Shares MySQL's wire protocol and DML (see
303
+ * `isMysqlLike`). Unsharded keyspaces retain normal MySQL DDL, while a
304
+ * sharded keyspace rejects foreign keys and AUTO_INCREMENT; select that
305
+ * stricter profile with `vitess.sharded`.
300
306
  * - 'sqlite': Lightweight engine; some features are limited or emulated
301
307
  * - 'browser': Browser-compatible mode that uses fetch() API calls instead of direct database connections
302
308
  */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The nearest ancestor of `startPath` containing a `package.json`, or the
3
+ * working directory when there is none — which keeps a bare directory (a test
4
+ * fixture, a scratch folder) working as its own workspace.
5
+ */
6
+ export declare function findWorkspaceRoot(startPath?: string): string;
7
+ /** The configured migration corpus, resolved from the workspace root. */
8
+ export declare function getSqlDirectory(workspaceRoot?: string, migrationDir?: string): string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-query-builder",
3
3
  "type": "module",
4
- "version": "0.2.6",
4
+ "version": "0.2.8",
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",