metal-orm 1.1.26 → 1.1.28

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 CHANGED
@@ -1557,19 +1557,19 @@ var NoReturningStrategy = class {
1557
1557
  if (!returning || returning.length === 0) return "";
1558
1558
  throw new Error("RETURNING is not supported by this dialect.");
1559
1559
  }
1560
- formatReturningColumns(returning, quoteIdentifier5) {
1560
+ formatReturningColumns(returning, quoteIdentifier9) {
1561
1561
  return returning.map((column) => {
1562
- const tablePart = column.table ? `${quoteIdentifier5(column.table)}.` : "";
1563
- const aliasPart = column.alias ? ` AS ${quoteIdentifier5(column.alias)}` : "";
1564
- return `${tablePart}${quoteIdentifier5(column.name)}${aliasPart}`;
1562
+ const tablePart = column.table ? `${quoteIdentifier9(column.table)}.` : "";
1563
+ const aliasPart = column.alias ? ` AS ${quoteIdentifier9(column.alias)}` : "";
1564
+ return `${tablePart}${quoteIdentifier9(column.name)}${aliasPart}`;
1565
1565
  }).join(", ");
1566
1566
  }
1567
1567
  };
1568
1568
  var StandardReturningStrategy = class extends NoReturningStrategy {
1569
- compileReturning(returning, _ctx, quoteIdentifier5) {
1569
+ compileReturning(returning, _ctx, quoteIdentifier9) {
1570
1570
  void _ctx;
1571
1571
  if (!returning || returning.length === 0) return "";
1572
- return ` RETURNING ${this.formatReturningColumns(returning, quoteIdentifier5)}`;
1572
+ return ` RETURNING ${this.formatReturningColumns(returning, quoteIdentifier9)}`;
1573
1573
  }
1574
1574
  };
1575
1575
 
@@ -1700,13 +1700,13 @@ var CteCompiler = class {
1700
1700
  * @param stripTrailingSemicolon - Function to remove trailing semicolons from SQL.
1701
1701
  * @returns SQL WITH clause string (e.g., "WITH cte_name AS (...) ") or empty string if no CTEs.
1702
1702
  */
1703
- static compileCtes(ast, ctx, quoteIdentifier5, compileSelectAst, normalizeSelectAst, stripTrailingSemicolon) {
1703
+ static compileCtes(ast, ctx, quoteIdentifier9, compileSelectAst, normalizeSelectAst, stripTrailingSemicolon) {
1704
1704
  if (!ast.ctes || ast.ctes.length === 0) return "";
1705
1705
  const hasRecursive = ast.ctes.some((cte) => cte.recursive);
1706
1706
  const prefix = hasRecursive ? "WITH RECURSIVE " : "WITH ";
1707
1707
  const cteDefs = ast.ctes.map((cte) => {
1708
- const name = quoteIdentifier5(cte.name);
1709
- const cols = cte.columns && cte.columns.length ? `(${cte.columns.map((c) => quoteIdentifier5(c)).join(", ")})` : "";
1708
+ const name = quoteIdentifier9(cte.name);
1709
+ const cols = cte.columns && cte.columns.length ? `(${cte.columns.map((c) => quoteIdentifier9(c)).join(", ")})` : "";
1710
1710
  const query = stripTrailingSemicolon(compileSelectAst(normalizeSelectAst(cte.query), ctx));
1711
1711
  return `${name}${cols} AS (${query})`;
1712
1712
  }).join(", ");
@@ -2259,15 +2259,15 @@ var PostgresTableFunctionStrategy = class extends StandardTableFunctionStrategy
2259
2259
  this.registerOverrides();
2260
2260
  }
2261
2261
  registerOverrides() {
2262
- this.add("ARRAY_UNNEST", ({ node, compiledArgs, quoteIdentifier: quoteIdentifier5 }) => {
2262
+ this.add("ARRAY_UNNEST", ({ node, compiledArgs, quoteIdentifier: quoteIdentifier9 }) => {
2263
2263
  const lateral = node.lateral ?? true;
2264
2264
  const withOrd = node.withOrdinality ?? false;
2265
2265
  const base = `unnest(${compiledArgs.join(", ")})${withOrd ? " WITH ORDINALITY" : ""}`;
2266
2266
  if (node.columnAliases?.length && !node.alias) {
2267
2267
  throw new Error("tvf(ARRAY_UNNEST) with columnAliases requires an alias.");
2268
2268
  }
2269
- const alias = node.alias ? ` AS ${quoteIdentifier5(node.alias)}` : "";
2270
- const cols = node.columnAliases?.length ? `(${node.columnAliases.map(quoteIdentifier5).join(", ")})` : "";
2269
+ const alias = node.alias ? ` AS ${quoteIdentifier9(node.alias)}` : "";
2270
+ const cols = node.columnAliases?.length ? `(${node.columnAliases.map(quoteIdentifier9).join(", ")})` : "";
2271
2271
  return `${lateral ? "LATERAL " : ""}${base}${alias}${cols}`;
2272
2272
  });
2273
2273
  }
@@ -2766,15 +2766,15 @@ var SqliteFunctionStrategy = class extends StandardFunctionStrategy {
2766
2766
 
2767
2767
  // src/core/dialect/sqlite/returning.ts
2768
2768
  var SqliteReturningStrategy = class {
2769
- compileReturning(returning, _ctx, quoteIdentifier5) {
2769
+ compileReturning(returning, _ctx, quoteIdentifier9) {
2770
2770
  void _ctx;
2771
2771
  if (!returning || returning.length === 0) return "";
2772
- return ` RETURNING ${this.formatReturningColumns(returning, quoteIdentifier5)}`;
2772
+ return ` RETURNING ${this.formatReturningColumns(returning, quoteIdentifier9)}`;
2773
2773
  }
2774
- formatReturningColumns(returning, quoteIdentifier5) {
2774
+ formatReturningColumns(returning, quoteIdentifier9) {
2775
2775
  return returning.map((column) => {
2776
- const alias = column.alias ? ` AS ${quoteIdentifier5(column.alias)}` : "";
2777
- return `${quoteIdentifier5(column.name)}${alias}`;
2776
+ const alias = column.alias ? ` AS ${quoteIdentifier9(column.alias)}` : "";
2777
+ return `${quoteIdentifier9(column.name)}${alias}`;
2778
2778
  }).join(", ");
2779
2779
  }
2780
2780
  };
@@ -2988,22 +2988,22 @@ var MssqlFunctionStrategy = class extends StandardFunctionStrategy {
2988
2988
 
2989
2989
  // src/core/dialect/mssql/output.ts
2990
2990
  var MssqlOutputStrategy = class {
2991
- compileReturning(returning, _ctx, quoteIdentifier5) {
2991
+ compileReturning(returning, _ctx, quoteIdentifier9) {
2992
2992
  void _ctx;
2993
- return this.compileOutput(returning, "inserted", quoteIdentifier5);
2993
+ return this.compileOutput(returning, "inserted", quoteIdentifier9);
2994
2994
  }
2995
- compileOutput(returning, prefix, quoteIdentifier5) {
2995
+ compileOutput(returning, prefix, quoteIdentifier9) {
2996
2996
  if (!returning || returning.length === 0) return "";
2997
2997
  const columns = returning.map((column) => {
2998
- const alias = column.alias ? ` AS ${quoteIdentifier5(column.alias)}` : "";
2999
- return `${prefix}.${quoteIdentifier5(column.name)}${alias}`;
2998
+ const alias = column.alias ? ` AS ${quoteIdentifier9(column.alias)}` : "";
2999
+ return `${prefix}.${quoteIdentifier9(column.name)}${alias}`;
3000
3000
  }).join(", ");
3001
3001
  return ` OUTPUT ${columns}`;
3002
3002
  }
3003
- formatReturningColumns(returning, quoteIdentifier5) {
3003
+ formatReturningColumns(returning, quoteIdentifier9) {
3004
3004
  return returning.map((column) => {
3005
- const alias = column.alias ? ` AS ${quoteIdentifier5(column.alias)}` : "";
3006
- return `${quoteIdentifier5(column.name)}${alias}`;
3005
+ const alias = column.alias ? ` AS ${quoteIdentifier9(column.alias)}` : "";
3006
+ return `${quoteIdentifier9(column.name)}${alias}`;
3007
3007
  }).join(", ");
3008
3008
  }
3009
3009
  };
@@ -11074,6 +11074,59 @@ var deleteFrom = (target) => {
11074
11074
  };
11075
11075
 
11076
11076
  // src/core/ddl/sql-writing.ts
11077
+ var escapeSqlString = (value) => value.replace(/'/g, "''");
11078
+ var isRawDefault = (value) => typeof value === "object" && value !== null && "raw" in value && typeof value.raw === "string";
11079
+ var createLiteralFormatter = (options = {}) => {
11080
+ const {
11081
+ nullLiteral = "NULL",
11082
+ booleanTrue = "TRUE",
11083
+ booleanFalse = "FALSE",
11084
+ numberFormatter = (value) => Number.isFinite(value) ? String(value) : nullLiteral,
11085
+ dateFormatter = (value) => `'${escapeSqlString(value.toISOString())}'`,
11086
+ stringWrapper = (escaped) => `'${escaped}'`,
11087
+ jsonWrapper = (escaped) => `'${escaped}'`
11088
+ } = options;
11089
+ const wrapString = stringWrapper;
11090
+ const wrapJson = jsonWrapper;
11091
+ const format = (value) => {
11092
+ if (isRawDefault(value)) return value.raw;
11093
+ if (value === null) return nullLiteral;
11094
+ if (typeof value === "number") {
11095
+ return numberFormatter(value);
11096
+ }
11097
+ if (typeof value === "boolean") {
11098
+ return value ? booleanTrue : booleanFalse;
11099
+ }
11100
+ if (value instanceof Date) {
11101
+ return dateFormatter(value);
11102
+ }
11103
+ if (typeof value === "string") {
11104
+ return wrapString(escapeSqlString(value));
11105
+ }
11106
+ return wrapJson(escapeSqlString(JSON.stringify(value)));
11107
+ };
11108
+ return {
11109
+ formatLiteral: format
11110
+ };
11111
+ };
11112
+ var formatLiteral = (formatter, value) => formatter.formatLiteral(value);
11113
+ var quoteQualified = (quoter, identifier) => {
11114
+ const parts = identifier.split(".");
11115
+ return parts.map((part) => quoter.quoteIdentifier(part)).join(".");
11116
+ };
11117
+ var renderIndexColumns = (quoter, columns) => columns.map((col2) => {
11118
+ if (typeof col2 === "string") {
11119
+ return quoter.quoteIdentifier(col2);
11120
+ }
11121
+ const parts = [quoter.quoteIdentifier(col2.column)];
11122
+ if (col2.order) {
11123
+ parts.push(col2.order);
11124
+ }
11125
+ if (col2.nulls) {
11126
+ parts.push(`NULLS ${col2.nulls}`);
11127
+ }
11128
+ return parts.join(" ");
11129
+ }).join(", ");
11077
11130
  var resolvePrimaryKey = (table) => {
11078
11131
  if (Array.isArray(table.primaryKey) && table.primaryKey.length > 0) {
11079
11132
  return table.primaryKey;
@@ -11210,13 +11263,11 @@ var deriveIndexName = (table, index) => {
11210
11263
  var tableKey = (name, schema) => schema ? `${schema}.${name}` : name;
11211
11264
  var mapTables = (schema) => {
11212
11265
  const map = /* @__PURE__ */ new Map();
11213
- for (const table of schema.tables) {
11214
- map.set(tableKey(table.name, table.schema), table);
11215
- }
11266
+ for (const table of schema.tables) map.set(tableKey(table.name, table.schema), table);
11216
11267
  return map;
11217
11268
  };
11218
- var buildAddColumnSql = (table, colName, dialect) => {
11219
- const column = table.columns[colName];
11269
+ var buildAddColumnSql = (table, columnName, dialect) => {
11270
+ const column = table.columns[columnName];
11220
11271
  const rendered = renderColumnDefinition(table, column, dialect);
11221
11272
  return `ALTER TABLE ${dialect.formatTableName(table)} ADD ${rendered.sql};`;
11222
11273
  };
@@ -11237,6 +11288,7 @@ var diffColumn = (expected, actual, dialect) => {
11237
11288
  autoIncrementChanged: !!expected.autoIncrement !== !!actual.autoIncrement
11238
11289
  };
11239
11290
  };
11291
+ var unsupportedMutationWarning = (dialect, operation, target) => `Dialect "${dialect.name}" does not provide the ${operation} capability for ${target}; manual migration is required.`;
11240
11292
  var diffSchema = (expectedTables, actualSchema, dialect, options = {}) => {
11241
11293
  const allowDestructive = options.allowDestructive ?? false;
11242
11294
  const plan = { changes: [], warnings: [] };
@@ -11255,87 +11307,121 @@ var diffSchema = (expectedTables, actualSchema, dialect, options = {}) => {
11255
11307
  });
11256
11308
  continue;
11257
11309
  }
11258
- const actualCols = new Map(actual.columns.map((c) => [c.name, c]));
11259
- for (const colName of Object.keys(table.columns)) {
11260
- if (!actualCols.has(colName)) {
11310
+ const actualColumns = new Map(actual.columns.map((column) => [column.name, column]));
11311
+ for (const columnName of Object.keys(table.columns)) {
11312
+ if (!actualColumns.has(columnName)) {
11261
11313
  plan.changes.push({
11262
11314
  kind: "addColumn",
11263
11315
  table: key,
11264
- description: `Add column ${colName} to ${key}`,
11265
- statements: [buildAddColumnSql(table, colName, dialect)],
11316
+ description: `Add column ${columnName} to ${key}`,
11317
+ statements: [buildAddColumnSql(table, columnName, dialect)],
11266
11318
  safe: true
11267
11319
  });
11268
- } else {
11269
- const expectedCol = table.columns[colName];
11270
- const actualCol = actualCols.get(colName);
11271
- const colDiff = diffColumn(expectedCol, actualCol, dialect);
11272
- const shouldAlter = colDiff.typeChanged || colDiff.nullabilityChanged || colDiff.defaultChanged || colDiff.autoIncrementChanged;
11273
- if (shouldAlter) {
11274
- const statements = dialect.alterColumnSql?.(table, expectedCol, actualCol, colDiff) ?? [];
11320
+ continue;
11321
+ }
11322
+ const expectedColumn = table.columns[columnName];
11323
+ const actualColumn = actualColumns.get(columnName);
11324
+ const columnDiff = diffColumn(expectedColumn, actualColumn, dialect);
11325
+ const shouldAlter = columnDiff.typeChanged || columnDiff.nullabilityChanged || columnDiff.defaultChanged || columnDiff.autoIncrementChanged;
11326
+ if (shouldAlter) {
11327
+ const capability = dialect.mutations.alterColumn;
11328
+ if (capability) {
11329
+ const statements = capability.compile(table, expectedColumn, actualColumn, columnDiff);
11275
11330
  if (statements.length > 0) {
11276
11331
  plan.changes.push({
11277
11332
  kind: "alterColumn",
11278
11333
  table: key,
11279
- description: `Alter column ${colName} on ${key}`,
11334
+ description: `Alter column ${columnName} on ${key}`,
11280
11335
  statements,
11281
11336
  safe: true
11282
11337
  });
11283
11338
  }
11284
- const warning = dialect.warnAlterColumn?.(table, expectedCol, actualCol, colDiff);
11339
+ const warning = capability.warning?.(table, expectedColumn, actualColumn, columnDiff);
11285
11340
  if (warning) plan.warnings.push(warning);
11341
+ } else {
11342
+ plan.warnings.push(
11343
+ unsupportedMutationWarning(dialect, "ALTER COLUMN", `${key}.${columnName}`)
11344
+ );
11286
11345
  }
11287
11346
  }
11288
11347
  }
11289
- for (const colName of actualCols.keys()) {
11290
- if (!table.columns[colName]) {
11291
- plan.changes.push({
11292
- kind: "dropColumn",
11293
- table: key,
11294
- description: `Drop column ${colName} from ${key}`,
11295
- statements: allowDestructive ? dialect.dropColumnSql(actual, colName) : [],
11296
- safe: false
11297
- });
11298
- const warning = dialect.warnDropColumn?.(actual, colName);
11348
+ for (const columnName of actualColumns.keys()) {
11349
+ if (table.columns[columnName]) continue;
11350
+ const capability = dialect.mutations.dropColumn;
11351
+ const statements = allowDestructive && capability ? capability.compile(actual, columnName) : [];
11352
+ plan.changes.push({
11353
+ kind: "dropColumn",
11354
+ table: key,
11355
+ description: `Drop column ${columnName} from ${key}`,
11356
+ statements,
11357
+ safe: false
11358
+ });
11359
+ if (!capability) {
11360
+ plan.warnings.push(
11361
+ unsupportedMutationWarning(dialect, "DROP COLUMN", `${key}.${columnName}`)
11362
+ );
11363
+ } else {
11364
+ const warning = capability.warning?.(actual, columnName);
11299
11365
  if (warning) plan.warnings.push(warning);
11300
11366
  }
11301
11367
  }
11302
11368
  const expectedIndexes = table.indexes ?? [];
11303
11369
  const actualIndexes = actual.indexes ?? [];
11304
- const actualIndexMap = new Map(actualIndexes.map((idx) => [idx.name, idx]));
11305
- for (const idx of expectedIndexes) {
11306
- const name = idx.name || deriveIndexName(table, idx);
11370
+ const actualIndexMap = new Map(actualIndexes.map((index) => [index.name, index]));
11371
+ for (const index of expectedIndexes) {
11372
+ const name = index.name || deriveIndexName(table, index);
11307
11373
  if (!actualIndexMap.has(name)) {
11308
11374
  plan.changes.push({
11309
11375
  kind: "addIndex",
11310
11376
  table: key,
11311
11377
  description: `Create index ${name} on ${key}`,
11312
- statements: [dialect.renderIndex(table, { ...idx, name })],
11378
+ statements: [dialect.renderIndex(table, { ...index, name })],
11313
11379
  safe: true
11314
11380
  });
11315
11381
  }
11316
11382
  }
11317
- for (const idx of actualIndexes) {
11318
- if (idx.name && !expectedIndexes.find((expected) => (expected.name || deriveIndexName(table, expected)) === idx.name)) {
11319
- plan.changes.push({
11320
- kind: "dropIndex",
11321
- table: key,
11322
- description: `Drop index ${idx.name} on ${key}`,
11323
- statements: allowDestructive ? dialect.dropIndexSql(actual, idx.name) : [],
11324
- safe: false
11325
- });
11383
+ for (const index of actualIndexes) {
11384
+ if (!index.name) continue;
11385
+ const expected = expectedIndexes.find(
11386
+ (candidate) => (candidate.name || deriveIndexName(table, candidate)) === index.name
11387
+ );
11388
+ if (expected) continue;
11389
+ const capability = dialect.mutations.dropIndex;
11390
+ const statements = allowDestructive && capability ? capability.compile(actual, index.name) : [];
11391
+ plan.changes.push({
11392
+ kind: "dropIndex",
11393
+ table: key,
11394
+ description: `Drop index ${index.name} on ${key}`,
11395
+ statements,
11396
+ safe: false
11397
+ });
11398
+ if (!capability) {
11399
+ plan.warnings.push(
11400
+ unsupportedMutationWarning(dialect, "DROP INDEX", `${key}.${index.name}`)
11401
+ );
11402
+ } else {
11403
+ const warning = capability.warning?.(actual, index.name);
11404
+ if (warning) plan.warnings.push(warning);
11326
11405
  }
11327
11406
  }
11328
11407
  }
11329
11408
  for (const actual of actualSchema.tables) {
11330
11409
  const key = tableKey(actual.name, actual.schema);
11331
- if (!expectedTables.find((t) => tableKey(t.name, t.schema) === key)) {
11332
- plan.changes.push({
11333
- kind: "dropTable",
11334
- table: key,
11335
- description: `Drop table ${key}`,
11336
- statements: allowDestructive ? dialect.dropTableSql(actual) : [],
11337
- safe: false
11338
- });
11410
+ if (expectedTables.find((table) => tableKey(table.name, table.schema) === key)) continue;
11411
+ const capability = dialect.mutations.dropTable;
11412
+ const statements = allowDestructive && capability ? capability.compile(actual) : [];
11413
+ plan.changes.push({
11414
+ kind: "dropTable",
11415
+ table: key,
11416
+ description: `Drop table ${key}`,
11417
+ statements,
11418
+ safe: false
11419
+ });
11420
+ if (!capability) {
11421
+ plan.warnings.push(unsupportedMutationWarning(dialect, "DROP TABLE", key));
11422
+ } else {
11423
+ const warning = capability.warning?.(actual);
11424
+ if (warning) plan.warnings.push(warning);
11339
11425
  }
11340
11426
  }
11341
11427
  return plan;
@@ -13281,6 +13367,604 @@ var introspectSchema = async (executor, dialect, options = {}) => {
13281
13367
  return handler.introspect(ctx, options);
13282
13368
  };
13283
13369
 
13370
+ // src/core/ddl/schema-dialect-composer.ts
13371
+ var composeSchemaDialect = (config) => {
13372
+ const quoteIdentifier9 = (id) => config.quoteIdentifier(id);
13373
+ const formatTableName = (table) => table.schema ? `${quoteIdentifier9(table.schema)}.${quoteIdentifier9(table.name)}` : quoteIdentifier9(table.name);
13374
+ let services;
13375
+ const renderDefault = (value, column) => config.renderDefault?.(value, column, services) ?? formatLiteral(config.literalFormatter, value);
13376
+ services = {
13377
+ name: config.name,
13378
+ quoteIdentifier: quoteIdentifier9,
13379
+ formatTableName,
13380
+ renderDefault
13381
+ };
13382
+ const mutations = config.mutations?.(services) ?? {};
13383
+ return {
13384
+ name: config.name,
13385
+ mutations,
13386
+ quoteIdentifier: quoteIdentifier9,
13387
+ formatTableName,
13388
+ renderColumnType: (column) => config.renderColumnType(column, services),
13389
+ renderDefault,
13390
+ renderAutoIncrement: (column, table) => config.renderAutoIncrement(column, table, services),
13391
+ renderReference(ref, table) {
13392
+ const parts = [
13393
+ "REFERENCES",
13394
+ quoteQualified({ quoteIdentifier: quoteIdentifier9 }, ref.table),
13395
+ `(${quoteIdentifier9(ref.column)})`
13396
+ ];
13397
+ if (ref.onDelete) parts.push("ON DELETE", ref.onDelete);
13398
+ if (ref.onUpdate) parts.push("ON UPDATE", ref.onUpdate);
13399
+ const suffix = config.renderReferenceSuffix?.(ref, table, services);
13400
+ if (suffix) parts.push(suffix);
13401
+ return parts.join(" ");
13402
+ },
13403
+ renderIndex: (table, index) => config.renderIndex(table, index, services),
13404
+ renderTableOptions: (table) => config.renderTableOptions?.(table, services),
13405
+ supportsPartialIndexes: () => config.supportsPartialIndexes ?? false,
13406
+ preferInlinePkAutoincrement: (column, table, pk) => config.preferInlinePkAutoincrement?.(column, table, pk, services) ?? false
13407
+ };
13408
+ };
13409
+ var createStandardDropTableCapability = (services) => ({
13410
+ compile: (table) => [`DROP TABLE IF EXISTS ${services.formatTableName(table)};`]
13411
+ });
13412
+ var createStandardDropColumnCapability = (services) => ({
13413
+ compile: (table, column) => [
13414
+ `ALTER TABLE ${services.formatTableName(table)} DROP COLUMN ${services.quoteIdentifier(column)};`
13415
+ ]
13416
+ });
13417
+
13418
+ // src/core/ddl/dialects/postgres-schema-dialect.ts
13419
+ var quoteIdentifier5 = (id) => `"${id}"`;
13420
+ var literalFormatter = createLiteralFormatter();
13421
+ var renderPostgresColumnType = (column, services) => {
13422
+ const override = column.dialectTypes?.[services.name] ?? column.dialectTypes?.default;
13423
+ if (override) return renderTypeWithArgs(override, column.args);
13424
+ const type = normalizeColumnType(column.type);
13425
+ switch (type) {
13426
+ case "int":
13427
+ case "integer":
13428
+ return "integer";
13429
+ case "bigint":
13430
+ return "bigint";
13431
+ case "uuid":
13432
+ return "uuid";
13433
+ case "boolean":
13434
+ return "boolean";
13435
+ case "json":
13436
+ return "jsonb";
13437
+ case "decimal":
13438
+ return column.args?.length ? `numeric(${column.args[0]}, ${column.args[1] ?? 0})` : "numeric";
13439
+ case "float":
13440
+ case "double":
13441
+ return "double precision";
13442
+ case "timestamptz":
13443
+ return "timestamptz";
13444
+ case "timestamp":
13445
+ return "timestamp";
13446
+ case "date":
13447
+ return "date";
13448
+ case "datetime":
13449
+ return "timestamp";
13450
+ case "varchar":
13451
+ return column.args?.length ? `varchar(${column.args[0]})` : "varchar";
13452
+ case "text":
13453
+ return "text";
13454
+ case "enum":
13455
+ return "text";
13456
+ case "binary":
13457
+ case "varbinary":
13458
+ case "blob":
13459
+ case "bytea":
13460
+ return "bytea";
13461
+ case "vector":
13462
+ return column.vectorOptions?.elementType === "float16" ? `halfvec(${column.vectorOptions.dimensions})` : column.args?.length ? `vector(${column.args[0]})` : "vector";
13463
+ case "halfvec":
13464
+ return column.args?.length ? `halfvec(${column.args[0]})` : "halfvec";
13465
+ default:
13466
+ return renderTypeWithArgs(String(type).toLowerCase(), column.args);
13467
+ }
13468
+ };
13469
+ var renderPostgresIndex = (table, index, services) => {
13470
+ const name = index.name || deriveIndexName(table, index);
13471
+ let columns = renderIndexColumns(services, index.columns);
13472
+ if (index.ops) columns = `${columns} ${index.ops}`;
13473
+ const unique = index.unique ? "UNIQUE " : "";
13474
+ const using = index.using ? ` USING ${index.using}` : "";
13475
+ let withClause = "";
13476
+ if (index.with) {
13477
+ if (typeof index.with === "string") {
13478
+ withClause = ` WITH (${index.with})`;
13479
+ } else {
13480
+ const params = Object.entries(index.with).map(([key, value]) => `${key} = ${value}`).join(", ");
13481
+ withClause = ` WITH (${params})`;
13482
+ }
13483
+ }
13484
+ const where = index.where ? ` WHERE ${index.where}` : "";
13485
+ return `CREATE ${unique}INDEX IF NOT EXISTS ${services.quoteIdentifier(name)} ON ${services.formatTableName(table)}${using} (${columns})${withClause}${where};`;
13486
+ };
13487
+ var createPostgresSchemaDialect = () => composeSchemaDialect({
13488
+ name: "postgres",
13489
+ quoteIdentifier: quoteIdentifier5,
13490
+ literalFormatter,
13491
+ renderColumnType: renderPostgresColumnType,
13492
+ renderAutoIncrement: (column) => {
13493
+ if (!column.autoIncrement) return void 0;
13494
+ const strategy = column.generated === "always" ? "GENERATED ALWAYS" : "GENERATED BY DEFAULT";
13495
+ return `${strategy} AS IDENTITY`;
13496
+ },
13497
+ renderIndex: renderPostgresIndex,
13498
+ renderReferenceSuffix: (ref) => ref.deferrable ? "DEFERRABLE INITIALLY DEFERRED" : void 0,
13499
+ supportsPartialIndexes: true,
13500
+ mutations: (services) => ({
13501
+ dropTable: createStandardDropTableCapability(services),
13502
+ dropColumn: createStandardDropColumnCapability(services),
13503
+ dropIndex: {
13504
+ compile(table, index) {
13505
+ const qualified = table.schema ? `${services.quoteIdentifier(table.schema)}.${services.quoteIdentifier(index)}` : services.quoteIdentifier(index);
13506
+ return [`DROP INDEX IF EXISTS ${qualified};`];
13507
+ }
13508
+ },
13509
+ alterColumn: {
13510
+ compile(table, column, actualColumn, diff) {
13511
+ void actualColumn;
13512
+ const statements = [];
13513
+ const tableName = services.formatTableName(table);
13514
+ const columnName = services.quoteIdentifier(column.name);
13515
+ if (diff.typeChanged) {
13516
+ statements.push(
13517
+ `ALTER TABLE ${tableName} ALTER COLUMN ${columnName} TYPE ${renderPostgresColumnType(column, services)};`
13518
+ );
13519
+ }
13520
+ if (diff.defaultChanged) {
13521
+ statements.push(
13522
+ column.default === void 0 ? `ALTER TABLE ${tableName} ALTER COLUMN ${columnName} DROP DEFAULT;` : `ALTER TABLE ${tableName} ALTER COLUMN ${columnName} SET DEFAULT ${services.renderDefault(column.default, column)};`
13523
+ );
13524
+ }
13525
+ if (diff.nullabilityChanged) {
13526
+ statements.push(
13527
+ `ALTER TABLE ${tableName} ALTER COLUMN ${columnName} ${column.notNull ? "SET" : "DROP"} NOT NULL;`
13528
+ );
13529
+ }
13530
+ if (diff.autoIncrementChanged) {
13531
+ if (column.autoIncrement) {
13532
+ const strategy = column.generated === "always" ? "ALWAYS" : "BY DEFAULT";
13533
+ statements.push(
13534
+ `ALTER TABLE ${tableName} ALTER COLUMN ${columnName} ADD GENERATED ${strategy} AS IDENTITY;`
13535
+ );
13536
+ } else {
13537
+ statements.push(`ALTER TABLE ${tableName} ALTER COLUMN ${columnName} DROP IDENTITY IF EXISTS;`);
13538
+ }
13539
+ }
13540
+ return statements;
13541
+ },
13542
+ warning(table, column, actualColumn, diff) {
13543
+ void table;
13544
+ void column;
13545
+ void actualColumn;
13546
+ return diff.autoIncrementChanged ? "Altering identity properties may fail if an existing sequence is attached; verify generated column state." : void 0;
13547
+ }
13548
+ }
13549
+ })
13550
+ });
13551
+ var PostgresSchemaDialect = class {
13552
+ delegate = createPostgresSchemaDialect();
13553
+ name = this.delegate.name;
13554
+ mutations = this.delegate.mutations;
13555
+ quoteIdentifier(id) {
13556
+ return this.delegate.quoteIdentifier(id);
13557
+ }
13558
+ formatTableName(table) {
13559
+ return this.delegate.formatTableName(table);
13560
+ }
13561
+ renderColumnType(column) {
13562
+ return this.delegate.renderColumnType(column);
13563
+ }
13564
+ renderDefault(value, column) {
13565
+ return this.delegate.renderDefault(value, column);
13566
+ }
13567
+ renderAutoIncrement(column, table) {
13568
+ return this.delegate.renderAutoIncrement(column, table);
13569
+ }
13570
+ renderReference(ref, table) {
13571
+ return this.delegate.renderReference(ref, table);
13572
+ }
13573
+ renderIndex(table, index) {
13574
+ return this.delegate.renderIndex(table, index);
13575
+ }
13576
+ renderTableOptions(table) {
13577
+ return this.delegate.renderTableOptions(table);
13578
+ }
13579
+ supportsPartialIndexes() {
13580
+ return this.delegate.supportsPartialIndexes();
13581
+ }
13582
+ preferInlinePkAutoincrement(column, table, pk) {
13583
+ return this.delegate.preferInlinePkAutoincrement(column, table, pk);
13584
+ }
13585
+ };
13586
+
13587
+ // src/core/ddl/dialects/mysql-schema-dialect.ts
13588
+ var quoteIdentifier6 = (id) => `\`${id}\``;
13589
+ var literalFormatter2 = createLiteralFormatter({ booleanTrue: "1", booleanFalse: "0" });
13590
+ var renderMySqlColumnType = (column, services) => {
13591
+ const override = column.dialectTypes?.[services.name] ?? column.dialectTypes?.default;
13592
+ if (override) return renderTypeWithArgs(override, column.args);
13593
+ const type = normalizeColumnType(column.type);
13594
+ switch (type) {
13595
+ case "int":
13596
+ case "integer":
13597
+ return "INT";
13598
+ case "bigint":
13599
+ return "BIGINT";
13600
+ case "uuid":
13601
+ return "CHAR(36)";
13602
+ case "boolean":
13603
+ return "TINYINT(1)";
13604
+ case "json":
13605
+ return "JSON";
13606
+ case "decimal":
13607
+ return column.args?.length ? `DECIMAL(${column.args[0]},${column.args[1] ?? 0})` : "DECIMAL";
13608
+ case "float":
13609
+ return column.args?.length ? `FLOAT(${column.args[0]})` : "FLOAT";
13610
+ case "double":
13611
+ return "DOUBLE";
13612
+ case "timestamptz":
13613
+ case "timestamp":
13614
+ return "TIMESTAMP";
13615
+ case "datetime":
13616
+ return "DATETIME";
13617
+ case "date":
13618
+ return "DATE";
13619
+ case "varchar":
13620
+ return column.args?.length ? `VARCHAR(${column.args[0]})` : "VARCHAR(255)";
13621
+ case "text":
13622
+ return "TEXT";
13623
+ case "binary":
13624
+ return column.args?.length ? `BINARY(${column.args[0]})` : "BINARY(255)";
13625
+ case "varbinary":
13626
+ return column.args?.length ? `VARBINARY(${column.args[0]})` : "VARBINARY(255)";
13627
+ case "blob":
13628
+ case "bytea":
13629
+ return "BLOB";
13630
+ case "enum":
13631
+ return column.args?.length ? `ENUM(${column.args.map((value) => `'${escapeSqlString(String(value))}'`).join(",")})` : "ENUM";
13632
+ case "vector":
13633
+ case "halfvec": {
13634
+ const dimensions = column.vectorOptions?.dimensions ?? column.args?.[0] ?? 3;
13635
+ return `VECTOR(${dimensions})`;
13636
+ }
13637
+ default:
13638
+ return renderTypeWithArgs(String(type).toUpperCase(), column.args);
13639
+ }
13640
+ };
13641
+ var createMySqlSchemaDialect = () => {
13642
+ let dialect;
13643
+ dialect = composeSchemaDialect({
13644
+ name: "mysql",
13645
+ quoteIdentifier: quoteIdentifier6,
13646
+ literalFormatter: literalFormatter2,
13647
+ renderColumnType: renderMySqlColumnType,
13648
+ renderAutoIncrement: (column) => column.autoIncrement ? "AUTO_INCREMENT" : void 0,
13649
+ renderIndex(table, index, services) {
13650
+ if (index.where) throw new Error("MySQL does not support partial/filtered indexes");
13651
+ const name = index.name || deriveIndexName(table, index);
13652
+ const columns = renderIndexColumns(services, index.columns);
13653
+ const unique = index.unique ? "UNIQUE " : "";
13654
+ return `CREATE ${unique}INDEX ${services.quoteIdentifier(name)} ON ${services.formatTableName(table)} (${columns});`;
13655
+ },
13656
+ renderTableOptions(table) {
13657
+ const parts = [];
13658
+ if (table.engine) parts.push(`ENGINE=${table.engine}`);
13659
+ if (table.charset) parts.push(`DEFAULT CHARSET=${table.charset}`);
13660
+ if (table.collation) parts.push(`COLLATE=${table.collation}`);
13661
+ return parts.length ? parts.join(" ") : void 0;
13662
+ },
13663
+ mutations: (services) => ({
13664
+ dropTable: createStandardDropTableCapability(services),
13665
+ dropColumn: createStandardDropColumnCapability(services),
13666
+ dropIndex: {
13667
+ compile: (table, index) => [
13668
+ `DROP INDEX ${services.quoteIdentifier(index)} ON ${services.formatTableName(table)};`
13669
+ ]
13670
+ },
13671
+ alterColumn: {
13672
+ compile(table, column, actualColumn, diff) {
13673
+ void actualColumn;
13674
+ void diff;
13675
+ const rendered = renderColumnDefinition(table, column, dialect);
13676
+ return [`ALTER TABLE ${services.formatTableName(table)} MODIFY COLUMN ${rendered.sql};`];
13677
+ }
13678
+ }
13679
+ })
13680
+ });
13681
+ return dialect;
13682
+ };
13683
+ var MySqlSchemaDialect = class {
13684
+ delegate = createMySqlSchemaDialect();
13685
+ name = this.delegate.name;
13686
+ mutations = this.delegate.mutations;
13687
+ quoteIdentifier(id) {
13688
+ return this.delegate.quoteIdentifier(id);
13689
+ }
13690
+ formatTableName(table) {
13691
+ return this.delegate.formatTableName(table);
13692
+ }
13693
+ renderColumnType(column) {
13694
+ return this.delegate.renderColumnType(column);
13695
+ }
13696
+ renderDefault(value, column) {
13697
+ return this.delegate.renderDefault(value, column);
13698
+ }
13699
+ renderAutoIncrement(column, table) {
13700
+ return this.delegate.renderAutoIncrement(column, table);
13701
+ }
13702
+ renderReference(ref, table) {
13703
+ return this.delegate.renderReference(ref, table);
13704
+ }
13705
+ renderIndex(table, index) {
13706
+ return this.delegate.renderIndex(table, index);
13707
+ }
13708
+ renderTableOptions(table) {
13709
+ return this.delegate.renderTableOptions(table);
13710
+ }
13711
+ supportsPartialIndexes() {
13712
+ return this.delegate.supportsPartialIndexes();
13713
+ }
13714
+ preferInlinePkAutoincrement(column, table, pk) {
13715
+ return this.delegate.preferInlinePkAutoincrement(column, table, pk);
13716
+ }
13717
+ };
13718
+
13719
+ // src/core/ddl/dialects/sqlite-schema-dialect.ts
13720
+ var quoteIdentifier7 = (id) => `"${id}"`;
13721
+ var literalFormatter3 = createLiteralFormatter({ booleanTrue: "1", booleanFalse: "0" });
13722
+ var renderSqliteColumnType = (column, services) => {
13723
+ const override = column.dialectTypes?.[services.name] ?? column.dialectTypes?.default;
13724
+ if (override) return renderTypeWithArgs(override, column.args);
13725
+ const type = normalizeColumnType(column.type);
13726
+ switch (type) {
13727
+ case "int":
13728
+ case "integer":
13729
+ case "bigint":
13730
+ case "boolean":
13731
+ return "INTEGER";
13732
+ case "decimal":
13733
+ case "float":
13734
+ case "double":
13735
+ return "REAL";
13736
+ case "date":
13737
+ case "datetime":
13738
+ case "timestamp":
13739
+ case "timestamptz":
13740
+ case "varchar":
13741
+ case "text":
13742
+ case "json":
13743
+ case "uuid":
13744
+ case "enum":
13745
+ return "TEXT";
13746
+ case "binary":
13747
+ case "varbinary":
13748
+ case "blob":
13749
+ case "bytea":
13750
+ return "BLOB";
13751
+ case "halfvec": {
13752
+ const dimensions = column.vectorOptions?.dimensions ?? column.args?.[0] ?? 3;
13753
+ return `float16[${dimensions}]`;
13754
+ }
13755
+ case "vector": {
13756
+ const dimensions = column.vectorOptions?.dimensions ?? column.args?.[0] ?? 3;
13757
+ const elementType = column.vectorOptions?.elementType === "float16" ? "float16" : "float32";
13758
+ return `${elementType}[${dimensions}]`;
13759
+ }
13760
+ default:
13761
+ return "TEXT";
13762
+ }
13763
+ };
13764
+ var createSqliteSchemaDialect = () => composeSchemaDialect({
13765
+ name: "sqlite",
13766
+ quoteIdentifier: quoteIdentifier7,
13767
+ literalFormatter: literalFormatter3,
13768
+ renderColumnType: renderSqliteColumnType,
13769
+ renderAutoIncrement(column, table) {
13770
+ const primaryKey = resolvePrimaryKey(table);
13771
+ return column.autoIncrement && primaryKey.length === 1 && primaryKey[0] === column.name ? "PRIMARY KEY AUTOINCREMENT" : void 0;
13772
+ },
13773
+ preferInlinePkAutoincrement: (column, table, primaryKey) => {
13774
+ void table;
13775
+ return !!(column.autoIncrement && primaryKey.length === 1 && primaryKey[0] === column.name);
13776
+ },
13777
+ renderIndex(table, index, services) {
13778
+ const name = index.name || deriveIndexName(table, index);
13779
+ const columns = renderIndexColumns(services, index.columns);
13780
+ const unique = index.unique ? "UNIQUE " : "";
13781
+ const where = index.where ? ` WHERE ${index.where}` : "";
13782
+ return `CREATE ${unique}INDEX IF NOT EXISTS ${services.quoteIdentifier(name)} ON ${services.formatTableName(table)} (${columns})${where};`;
13783
+ },
13784
+ supportsPartialIndexes: true,
13785
+ mutations: (services) => ({
13786
+ dropTable: createStandardDropTableCapability(services),
13787
+ dropIndex: {
13788
+ compile: (_table, index) => [`DROP INDEX IF EXISTS ${services.quoteIdentifier(index)};`]
13789
+ }
13790
+ })
13791
+ });
13792
+ var SQLiteSchemaDialect = class {
13793
+ delegate = createSqliteSchemaDialect();
13794
+ name = this.delegate.name;
13795
+ mutations = this.delegate.mutations;
13796
+ quoteIdentifier(id) {
13797
+ return this.delegate.quoteIdentifier(id);
13798
+ }
13799
+ formatTableName(table) {
13800
+ return this.delegate.formatTableName(table);
13801
+ }
13802
+ renderColumnType(column) {
13803
+ return this.delegate.renderColumnType(column);
13804
+ }
13805
+ renderDefault(value, column) {
13806
+ return this.delegate.renderDefault(value, column);
13807
+ }
13808
+ renderAutoIncrement(column, table) {
13809
+ return this.delegate.renderAutoIncrement(column, table);
13810
+ }
13811
+ renderReference(ref, table) {
13812
+ return this.delegate.renderReference(ref, table);
13813
+ }
13814
+ renderIndex(table, index) {
13815
+ return this.delegate.renderIndex(table, index);
13816
+ }
13817
+ renderTableOptions(table) {
13818
+ return this.delegate.renderTableOptions(table);
13819
+ }
13820
+ supportsPartialIndexes() {
13821
+ return this.delegate.supportsPartialIndexes();
13822
+ }
13823
+ preferInlinePkAutoincrement(column, table, pk) {
13824
+ return this.delegate.preferInlinePkAutoincrement(column, table, pk);
13825
+ }
13826
+ };
13827
+
13828
+ // src/core/ddl/dialects/mssql-schema-dialect.ts
13829
+ var quoteIdentifier8 = (id) => `[${id.replace(/]/g, "]]")}]`;
13830
+ var literalFormatter4 = createLiteralFormatter({ booleanTrue: "1", booleanFalse: "0" });
13831
+ var renderMssqlColumnType = (column, services) => {
13832
+ const override = column.dialectTypes?.[services.name] ?? column.dialectTypes?.default;
13833
+ if (override) return renderTypeWithArgs(override, column.args);
13834
+ const type = normalizeColumnType(column.type);
13835
+ switch (type) {
13836
+ case "int":
13837
+ case "integer":
13838
+ return "INT";
13839
+ case "bigint":
13840
+ return "BIGINT";
13841
+ case "uuid":
13842
+ return "UNIQUEIDENTIFIER";
13843
+ case "boolean":
13844
+ return "BIT";
13845
+ case "json":
13846
+ return "NVARCHAR(MAX)";
13847
+ case "decimal":
13848
+ return column.args?.length ? `DECIMAL(${column.args[0]},${column.args[1] ?? 0})` : "DECIMAL(18,0)";
13849
+ case "float":
13850
+ case "double":
13851
+ return "FLOAT";
13852
+ case "timestamptz":
13853
+ case "timestamp":
13854
+ case "datetime":
13855
+ return "DATETIME2";
13856
+ case "date":
13857
+ return "DATE";
13858
+ case "varchar":
13859
+ return column.args?.length ? `NVARCHAR(${column.args[0]})` : "NVARCHAR(255)";
13860
+ case "text":
13861
+ return "NVARCHAR(MAX)";
13862
+ case "binary": {
13863
+ const length2 = column.args?.[0];
13864
+ return length2 !== void 0 ? `BINARY(${length2})` : "BINARY(255)";
13865
+ }
13866
+ case "varbinary": {
13867
+ const length2 = column.args?.[0];
13868
+ if (typeof length2 === "string" && length2.toLowerCase() === "max") return "VARBINARY(MAX)";
13869
+ return length2 !== void 0 ? `VARBINARY(${length2})` : "VARBINARY(255)";
13870
+ }
13871
+ case "blob":
13872
+ case "bytea":
13873
+ return "VARBINARY(MAX)";
13874
+ case "enum":
13875
+ return "NVARCHAR(255)";
13876
+ case "vector": {
13877
+ const dimensions = column.vectorOptions?.dimensions ?? column.args?.[0] ?? 3;
13878
+ const elementType = column.vectorOptions?.elementType;
13879
+ return elementType ? `VECTOR(${dimensions}, ${elementType})` : `VECTOR(${dimensions})`;
13880
+ }
13881
+ case "halfvec": {
13882
+ const dimensions = column.vectorOptions?.dimensions ?? column.args?.[0] ?? 3;
13883
+ return `VECTOR(${dimensions}, float16)`;
13884
+ }
13885
+ default:
13886
+ return renderTypeWithArgs(String(type).toUpperCase(), column.args);
13887
+ }
13888
+ };
13889
+ var createMssqlSchemaDialect = () => composeSchemaDialect({
13890
+ name: "mssql",
13891
+ quoteIdentifier: quoteIdentifier8,
13892
+ literalFormatter: literalFormatter4,
13893
+ renderColumnType: renderMssqlColumnType,
13894
+ renderAutoIncrement: (column) => column.autoIncrement ? "IDENTITY(1,1)" : void 0,
13895
+ renderIndex(table, index, services) {
13896
+ const name = index.name || deriveIndexName(table, index);
13897
+ const columns = renderIndexColumns(services, index.columns);
13898
+ const unique = index.unique ? "UNIQUE " : "";
13899
+ const where = index.where ? ` WHERE ${index.where}` : "";
13900
+ return `CREATE ${unique}INDEX ${services.quoteIdentifier(name)} ON ${services.formatTableName(table)} (${columns})${where};`;
13901
+ },
13902
+ supportsPartialIndexes: true,
13903
+ mutations: (services) => ({
13904
+ dropTable: createStandardDropTableCapability(services),
13905
+ dropColumn: createStandardDropColumnCapability(services),
13906
+ dropIndex: {
13907
+ compile: (table, index) => [
13908
+ `DROP INDEX ${services.quoteIdentifier(index)} ON ${services.formatTableName(table)};`
13909
+ ]
13910
+ },
13911
+ alterColumn: {
13912
+ compile(table, column, actualColumn, diff) {
13913
+ void actualColumn;
13914
+ const statements = [];
13915
+ if (diff.typeChanged || diff.nullabilityChanged) {
13916
+ const nullability = column.notNull ? "NOT NULL" : "NULL";
13917
+ statements.push(
13918
+ `ALTER TABLE ${services.formatTableName(table)} ALTER COLUMN ${services.quoteIdentifier(column.name)} ${renderMssqlColumnType(column, services)} ${nullability};`
13919
+ );
13920
+ }
13921
+ return statements;
13922
+ },
13923
+ warning(table, column, actualColumn, diff) {
13924
+ void table;
13925
+ void column;
13926
+ void actualColumn;
13927
+ return diff.defaultChanged || diff.autoIncrementChanged ? "Altering defaults or identity on MSSQL is not automated (requires dropping/adding default or identity constraints manually)." : void 0;
13928
+ }
13929
+ }
13930
+ })
13931
+ });
13932
+ var MSSqlSchemaDialect = class {
13933
+ delegate = createMssqlSchemaDialect();
13934
+ name = this.delegate.name;
13935
+ mutations = this.delegate.mutations;
13936
+ quoteIdentifier(id) {
13937
+ return this.delegate.quoteIdentifier(id);
13938
+ }
13939
+ formatTableName(table) {
13940
+ return this.delegate.formatTableName(table);
13941
+ }
13942
+ renderColumnType(column) {
13943
+ return this.delegate.renderColumnType(column);
13944
+ }
13945
+ renderDefault(value, column) {
13946
+ return this.delegate.renderDefault(value, column);
13947
+ }
13948
+ renderAutoIncrement(column, table) {
13949
+ return this.delegate.renderAutoIncrement(column, table);
13950
+ }
13951
+ renderReference(ref, table) {
13952
+ return this.delegate.renderReference(ref, table);
13953
+ }
13954
+ renderIndex(table, index) {
13955
+ return this.delegate.renderIndex(table, index);
13956
+ }
13957
+ renderTableOptions(table) {
13958
+ return this.delegate.renderTableOptions(table);
13959
+ }
13960
+ supportsPartialIndexes() {
13961
+ return this.delegate.supportsPartialIndexes();
13962
+ }
13963
+ preferInlinePkAutoincrement(column, table, pk) {
13964
+ return this.delegate.preferInlinePkAutoincrement(column, table, pk);
13965
+ }
13966
+ };
13967
+
13284
13968
  // src/core/functions/numeric.ts
13285
13969
  var isColumnDef2 = (val) => !!val && typeof val === "object" && "type" in val && "name" in val;
13286
13970
  var toOperand3 = (input) => {
@@ -21777,6 +22461,7 @@ export {
21777
22461
  KeyvCacheAdapter,
21778
22462
  Length,
21779
22463
  Lower,
22464
+ MSSqlSchemaDialect,
21780
22465
  MemoryCacheAdapter,
21781
22466
  MorphMany,
21782
22467
  MorphOne,
@@ -21789,6 +22474,7 @@ export {
21789
22474
  MssqlUpdateCompiler,
21790
22475
  MySqlDialect,
21791
22476
  MySqlProcedureCompiler,
22477
+ MySqlSchemaDialect,
21792
22478
  MySqlUpsertStrategy,
21793
22479
  NestedSetStrategy,
21794
22480
  NoReturningStrategy,
@@ -21800,6 +22486,7 @@ export {
21800
22486
  PostgresDialect,
21801
22487
  PostgresProcedureCompiler,
21802
22488
  PostgresReturningStrategy,
22489
+ PostgresSchemaDialect,
21803
22490
  PostgresUpsertStrategy,
21804
22491
  PrimaryKey,
21805
22492
  ProcedureCallBuilder,
@@ -21807,6 +22494,7 @@ export {
21807
22494
  QueryCacheManager,
21808
22495
  RedisCacheAdapter,
21809
22496
  RelationKinds,
22497
+ SQLiteSchemaDialect,
21810
22498
  STANDARD_COLUMN_TYPES,
21811
22499
  SelectQueryBuilder,
21812
22500
  SqlServerDialect,
@@ -21890,6 +22578,7 @@ export {
21890
22578
  columnToOpenApiSchema,
21891
22579
  columnTypeToOpenApiFormat,
21892
22580
  columnTypeToOpenApiType,
22581
+ composeSchemaDialect,
21893
22582
  composeSqlDialect,
21894
22583
  computePaginationMetadata,
21895
22584
  computeSchemaHash,
@@ -21908,19 +22597,26 @@ export {
21908
22597
  createEntityFromRow,
21909
22598
  createEntityProxy,
21910
22599
  createExecutorFromQueryRunner,
22600
+ createLiteralFormatter,
21911
22601
  createMssqlCompilerSet,
21912
22602
  createMssqlExecutor,
22603
+ createMssqlSchemaDialect,
21913
22604
  createMySqlDialect,
22605
+ createMySqlSchemaDialect,
21914
22606
  createMysqlExecutor,
21915
22607
  createPooledExecutorFactory,
21916
22608
  createPostgresDialect,
21917
22609
  createPostgresExecutor,
22610
+ createPostgresSchemaDialect,
21918
22611
  createQueryLoggingExecutor,
21919
22612
  createRef,
21920
22613
  createSqlDialect,
21921
22614
  createSqlServerDialect,
21922
22615
  createSqliteDialect,
21923
22616
  createSqliteExecutor,
22617
+ createSqliteSchemaDialect,
22618
+ createStandardDropColumnCapability,
22619
+ createStandardDropTableCapability,
21924
22620
  createTediousExecutor,
21925
22621
  createTediousMssqlClient,
21926
22622
  createTreeManager,