drizzle-kit 0.29.1 → 0.30.0-1abaaf8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. package/api.js +394 -264
  2. package/api.mjs +394 -264
  3. package/bin.cjs +70 -99
  4. package/package.json +1 -1
package/api.js CHANGED
@@ -5695,8 +5695,8 @@ var init_lib = __esm({
5695
5695
  unknownKeys: "strict",
5696
5696
  ...message !== void 0 ? {
5697
5697
  errorMap: (issue, ctx) => {
5698
- var _a413, _b303, _c13, _d6;
5699
- const defaultError = (_c13 = (_b303 = (_a413 = this._def).errorMap) === null || _b303 === void 0 ? void 0 : _b303.call(_a413, issue, ctx).message) !== null && _c13 !== void 0 ? _c13 : ctx.defaultError;
5698
+ var _a413, _b303, _c14, _d6;
5699
+ const defaultError = (_c14 = (_b303 = (_a413 = this._def).errorMap) === null || _b303 === void 0 ? void 0 : _b303.call(_a413, issue, ctx).message) !== null && _c14 !== void 0 ? _c14 : ctx.defaultError;
5700
5700
  if (issue.code === "unrecognized_keys")
5701
5701
  return {
5702
5702
  message: (_d6 = errorUtil.errToObj(message).message) !== null && _d6 !== void 0 ? _d6 : defaultError
@@ -12331,7 +12331,7 @@ var init_sqlgenerator = __esm({
12331
12331
  const { tableName, schema: schema5, columns, compositePKs, uniqueConstraints, checkConstraints, policies, isRLSEnabled } = st;
12332
12332
  let statement = "";
12333
12333
  const name2 = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
12334
- statement += `CREATE TABLE IF NOT EXISTS ${name2} (
12334
+ statement += `CREATE TABLE ${name2} (
12335
12335
  `;
12336
12336
  for (let i = 0; i < columns.length; i++) {
12337
12337
  const column5 = columns[i];
@@ -13169,7 +13169,7 @@ WITH ${withCheckOption} CHECK OPTION` : "";
13169
13169
  convert(statement) {
13170
13170
  const { tableName, columnName, schema: schema5 } = statement;
13171
13171
  const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
13172
- return `ALTER TABLE ${tableNameWithSchema} DROP COLUMN IF EXISTS "${columnName}";`;
13172
+ return `ALTER TABLE ${tableNameWithSchema} DROP COLUMN "${columnName}";`;
13173
13173
  }
13174
13174
  };
13175
13175
  MySqlAlterTableDropColumnConvertor = class extends Convertor {
@@ -13590,7 +13590,7 @@ WITH ${withCheckOption} CHECK OPTION` : "";
13590
13590
  for (const table5 of Object.values(json22.tables)) {
13591
13591
  for (const index5 of Object.values(table5.indexes)) {
13592
13592
  const unsquashed = SQLiteSquasher.unsquashIdx(index5);
13593
- sqlStatements.push(`DROP INDEX IF EXISTS "${unsquashed.name}";`);
13593
+ sqlStatements.push(`DROP INDEX "${unsquashed.name}";`);
13594
13594
  indexes.push({ ...unsquashed, tableName: table5.name });
13595
13595
  }
13596
13596
  }
@@ -14104,13 +14104,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
14104
14104
  const toColumnsString = columnsTo.map((it) => `"${it}"`).join(",");
14105
14105
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${tableFrom}"` : `"${tableFrom}"`;
14106
14106
  const tableToNameWithSchema = schemaTo ? `"${schemaTo}"."${tableTo}"` : `"${tableTo}"`;
14107
- const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name2}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
14108
- let sql2 = "DO $$ BEGIN\n";
14109
- sql2 += " " + alterStatement + ";\n";
14110
- sql2 += "EXCEPTION\n";
14111
- sql2 += " WHEN duplicate_object THEN null;\n";
14112
- sql2 += "END $$;\n";
14113
- return sql2;
14107
+ const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name2}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement};`;
14108
+ return alterStatement;
14114
14109
  }
14115
14110
  };
14116
14111
  LibSQLCreateForeignKeyConvertor = class extends Convertor {
@@ -14167,12 +14162,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
14167
14162
  const toColumnsString = newFk.columnsTo.map((it) => `"${it}"`).join(",");
14168
14163
  const tableFromNameWithSchema = oldFk.schemaTo ? `"${oldFk.schemaTo}"."${oldFk.tableFrom}"` : `"${oldFk.tableFrom}"`;
14169
14164
  const tableToNameWithSchema = newFk.schemaTo ? `"${newFk.schemaTo}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
14170
- const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
14171
- sql2 += "DO $$ BEGIN\n";
14172
- sql2 += " " + alterStatement + ";\n";
14173
- sql2 += "EXCEPTION\n";
14174
- sql2 += " WHEN duplicate_object THEN null;\n";
14175
- sql2 += "END $$;\n";
14165
+ const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement};`;
14166
+ sql2 += alterStatement;
14176
14167
  return sql2;
14177
14168
  }
14178
14169
  };
@@ -14228,7 +14219,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
14228
14219
  reversedString = reversedString.slice(0, -1);
14229
14220
  return reversedString;
14230
14221
  }
14231
- return `CREATE ${indexPart}${concurrently ? " CONCURRENTLY" : ""} IF NOT EXISTS "${name2}" ON ${tableNameWithSchema} USING ${method} (${value})${Object.keys(withMap).length !== 0 ? ` WITH (${reverseLogic(withMap)})` : ""}${where ? ` WHERE ${where}` : ""};`;
14222
+ return `CREATE ${indexPart}${concurrently ? " CONCURRENTLY" : ""} "${name2}" ON ${tableNameWithSchema} USING ${method} (${value})${Object.keys(withMap).length !== 0 ? ` WITH (${reverseLogic(withMap)})` : ""}${where ? ` WHERE ${where}` : ""};`;
14232
14223
  }
14233
14224
  };
14234
14225
  CreateMySqlIndexConvertor = class extends Convertor {
@@ -14283,7 +14274,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
14283
14274
  }
14284
14275
  convert(statement) {
14285
14276
  const { name: name2 } = PgSquasher.unsquashIdx(statement.data);
14286
- return `DROP INDEX IF EXISTS "${name2}";`;
14277
+ return `DROP INDEX "${name2}";`;
14287
14278
  }
14288
14279
  };
14289
14280
  PgCreateSchemaConvertor = class extends Convertor {
@@ -14354,7 +14345,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
14354
14345
  }
14355
14346
  convert(statement) {
14356
14347
  const { name: name2 } = PgSquasher.unsquashIdx(statement.data);
14357
- return `DROP INDEX IF EXISTS \`${name2}\`;`;
14348
+ return `DROP INDEX \`${name2}\`;`;
14358
14349
  }
14359
14350
  };
14360
14351
  MySqlDropIndexConvertor = class extends Convertor {
@@ -21983,7 +21974,7 @@ var version;
21983
21974
  var init_version = __esm({
21984
21975
  "../drizzle-orm/dist/version.js"() {
21985
21976
  "use strict";
21986
- version = "0.37.0";
21977
+ version = "0.38.0";
21987
21978
  }
21988
21979
  });
21989
21980
 
@@ -22168,7 +22159,10 @@ function fillPlaceholders(params, values) {
22168
22159
  return p;
22169
22160
  });
22170
22161
  }
22171
- var _a19, FakePrimitiveParam, _a20, StringChunk, _a21, _SQL, SQL, _a22, Name, noopDecoder, noopEncoder, noopMapper, _a23, Param, _a24, Placeholder, _a25, _b10, View3;
22162
+ function isView(view4) {
22163
+ return typeof view4 === "object" && view4 !== null && IsDrizzleView in view4;
22164
+ }
22165
+ var _a19, FakePrimitiveParam, _a20, StringChunk, _a21, _SQL, SQL, _a22, Name, noopDecoder, noopEncoder, noopMapper, _a23, Param, _a24, Placeholder, IsDrizzleView, _a25, _b10, _c2, View3;
22172
22166
  var init_sql = __esm({
22173
22167
  "../drizzle-orm/dist/sql/sql.js"() {
22174
22168
  "use strict";
@@ -22493,11 +22487,14 @@ var init_sql = __esm({
22493
22487
  }
22494
22488
  };
22495
22489
  __publicField(Placeholder, _a24, "Placeholder");
22496
- _b10 = entityKind, _a25 = ViewBaseConfig;
22490
+ IsDrizzleView = Symbol.for("drizzle:IsDrizzleView");
22491
+ _c2 = entityKind, _b10 = ViewBaseConfig, _a25 = IsDrizzleView;
22497
22492
  View3 = class {
22498
22493
  constructor({ name: name2, schema: schema5, selectedFields, query }) {
22499
22494
  /** @internal */
22500
- __publicField(this, _a25);
22495
+ __publicField(this, _b10);
22496
+ /** @internal */
22497
+ __publicField(this, _a25, true);
22501
22498
  this[ViewBaseConfig] = {
22502
22499
  name: name2,
22503
22500
  originalName: name2,
@@ -22512,7 +22509,7 @@ var init_sql = __esm({
22512
22509
  return new SQL([this]);
22513
22510
  }
22514
22511
  };
22515
- __publicField(View3, _b10, "View");
22512
+ __publicField(View3, _c2, "View");
22516
22513
  Column2.prototype.getSQL = function() {
22517
22514
  return new SQL([this]);
22518
22515
  };
@@ -23033,6 +23030,9 @@ function applyMixins(baseClass, extendedClasses) {
23033
23030
  function getTableColumns(table5) {
23034
23031
  return table5[Table2.Symbol.Columns];
23035
23032
  }
23033
+ function getViewSelectedFields(view4) {
23034
+ return view4[ViewBaseConfig].selectedFields;
23035
+ }
23036
23036
  function getTableLikeName(table5) {
23037
23037
  return is(table5, Subquery) ? table5._.alias : is(table5, View3) ? table5[ViewBaseConfig].name : is(table5, SQL) ? void 0 : table5[Table2.Symbol.IsAlias] ? table5[Table2.Symbol.Name] : table5[Table2.Symbol.BaseName];
23038
23038
  }
@@ -23327,7 +23327,10 @@ var init_char = __esm({
23327
23327
  }
23328
23328
  /** @internal */
23329
23329
  build(table5) {
23330
- return new PgChar(table5, this.config);
23330
+ return new PgChar(
23331
+ table5,
23332
+ this.config
23333
+ );
23331
23334
  }
23332
23335
  };
23333
23336
  __publicField(PgCharBuilder, _a46, "PgCharBuilder");
@@ -24459,7 +24462,10 @@ var init_varchar = __esm({
24459
24462
  }
24460
24463
  /** @internal */
24461
24464
  build(table5) {
24462
- return new PgVarchar(table5, this.config);
24465
+ return new PgVarchar(
24466
+ table5,
24467
+ this.config
24468
+ );
24463
24469
  }
24464
24470
  };
24465
24471
  __publicField(PgVarcharBuilder, _a105, "PgVarcharBuilder");
@@ -24619,7 +24625,10 @@ var init_vector = __esm({
24619
24625
  }
24620
24626
  /** @internal */
24621
24627
  build(table5) {
24622
- return new PgVector(table5, this.config);
24628
+ return new PgVector(
24629
+ table5,
24630
+ this.config
24631
+ );
24623
24632
  }
24624
24633
  };
24625
24634
  __publicField(PgVectorBuilder, _a113, "PgVectorBuilder");
@@ -24751,7 +24760,7 @@ function pgTableWithSchema(name2, columns, extraConfig, schema5, baseName = name
24751
24760
  }
24752
24761
  });
24753
24762
  }
24754
- var InlineForeignKeys, EnableRLS, _a115, _b94, _c2, _d2, _e2, PgTable, pgTable;
24763
+ var InlineForeignKeys, EnableRLS, _a115, _b94, _c3, _d2, _e2, PgTable, pgTable;
24755
24764
  var init_table2 = __esm({
24756
24765
  "../drizzle-orm/dist/pg-core/table.js"() {
24757
24766
  "use strict";
@@ -24760,11 +24769,11 @@ var init_table2 = __esm({
24760
24769
  init_all();
24761
24770
  InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
24762
24771
  EnableRLS = Symbol.for("drizzle:EnableRLS");
24763
- PgTable = class extends (_e2 = Table2, _d2 = entityKind, _c2 = InlineForeignKeys, _b94 = EnableRLS, _a115 = Table2.Symbol.ExtraConfigBuilder, _e2) {
24772
+ PgTable = class extends (_e2 = Table2, _d2 = entityKind, _c3 = InlineForeignKeys, _b94 = EnableRLS, _a115 = Table2.Symbol.ExtraConfigBuilder, _e2) {
24764
24773
  constructor() {
24765
24774
  super(...arguments);
24766
24775
  /**@internal */
24767
- __publicField(this, _c2, []);
24776
+ __publicField(this, _c3, []);
24768
24777
  /** @internal */
24769
24778
  __publicField(this, _b94, false);
24770
24779
  /** @internal */
@@ -25279,6 +25288,7 @@ __export(dist_exports, {
25279
25288
  getTableLikeName: () => getTableLikeName,
25280
25289
  getTableName: () => getTableName,
25281
25290
  getTableUniqueName: () => getTableUniqueName,
25291
+ getViewSelectedFields: () => getViewSelectedFields,
25282
25292
  gt: () => gt,
25283
25293
  gte: () => gte,
25284
25294
  hammingDistance: () => hammingDistance,
@@ -25294,6 +25304,7 @@ __export(dist_exports, {
25294
25304
  isNull: () => isNull,
25295
25305
  isSQLWrapper: () => isSQLWrapper,
25296
25306
  isTable: () => isTable,
25307
+ isView: () => isView,
25297
25308
  jaccardDistance: () => jaccardDistance,
25298
25309
  l1Distance: () => l1Distance,
25299
25310
  l2Distance: () => l2Distance,
@@ -28143,13 +28154,13 @@ var init_query_builders = __esm({
28143
28154
  });
28144
28155
 
28145
28156
  // ../drizzle-orm/dist/pg-core/query-builders/count.js
28146
- var _a139, _b104, _c3, _PgCountBuilder, PgCountBuilder;
28157
+ var _a139, _b104, _c4, _PgCountBuilder, PgCountBuilder;
28147
28158
  var init_count = __esm({
28148
28159
  "../drizzle-orm/dist/pg-core/query-builders/count.js"() {
28149
28160
  "use strict";
28150
28161
  init_entity();
28151
28162
  init_sql();
28152
- _PgCountBuilder = class _PgCountBuilder extends (_c3 = SQL, _b104 = entityKind, _a139 = Symbol.toStringTag, _c3) {
28163
+ _PgCountBuilder = class _PgCountBuilder extends (_c4 = SQL, _b104 = entityKind, _a139 = Symbol.toStringTag, _c4) {
28153
28164
  constructor(params) {
28154
28165
  super(_PgCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
28155
28166
  __publicField(this, "sql");
@@ -28888,7 +28899,7 @@ function isPgView(obj) {
28888
28899
  function isPgMaterializedView(obj) {
28889
28900
  return is(obj, PgMaterializedView);
28890
28901
  }
28891
- var _a150, DefaultViewBuilderCore, _a151, _b107, ViewBuilder, _a152, _b108, ManualViewBuilder, _a153, MaterializedViewBuilderCore, _a154, _b109, MaterializedViewBuilder, _a155, _b110, ManualMaterializedViewBuilder, _a156, _b111, _c4, PgView2, PgMaterializedViewConfig, _a157, _b112, _c5, PgMaterializedView;
28902
+ var _a150, DefaultViewBuilderCore, _a151, _b107, ViewBuilder, _a152, _b108, ManualViewBuilder, _a153, MaterializedViewBuilderCore, _a154, _b109, MaterializedViewBuilder, _a155, _b110, ManualMaterializedViewBuilder, _a156, _b111, _c5, PgView2, PgMaterializedViewConfig, _a157, _b112, _c6, PgMaterializedView;
28892
28903
  var init_view = __esm({
28893
28904
  "../drizzle-orm/dist/pg-core/view.js"() {
28894
28905
  "use strict";
@@ -29098,7 +29109,7 @@ var init_view = __esm({
29098
29109
  }
29099
29110
  };
29100
29111
  __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
29101
- PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
29112
+ PgView2 = class extends (_c5 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c5) {
29102
29113
  constructor({ pgConfig, config }) {
29103
29114
  super(config);
29104
29115
  __publicField(this, _a156);
@@ -29111,7 +29122,7 @@ var init_view = __esm({
29111
29122
  };
29112
29123
  __publicField(PgView2, _b111, "PgView");
29113
29124
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
29114
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
29125
+ PgMaterializedView = class extends (_c6 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c6) {
29115
29126
  constructor({ pgConfig, config }) {
29116
29127
  super(config);
29117
29128
  __publicField(this, _a157);
@@ -31659,7 +31670,10 @@ var init_text2 = __esm({
31659
31670
  }
31660
31671
  /** @internal */
31661
31672
  build(table5) {
31662
- return new SQLiteText(table5, this.config);
31673
+ return new SQLiteText(
31674
+ table5,
31675
+ this.config
31676
+ );
31663
31677
  }
31664
31678
  };
31665
31679
  __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
@@ -31760,7 +31774,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema5, baseName = name2)
31760
31774
  }
31761
31775
  return table5;
31762
31776
  }
31763
- var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e3, SQLiteTable, sqliteTable;
31777
+ var InlineForeignKeys2, _a195, _b140, _c7, _d3, _e3, SQLiteTable, sqliteTable;
31764
31778
  var init_table3 = __esm({
31765
31779
  "../drizzle-orm/dist/sqlite-core/table.js"() {
31766
31780
  "use strict";
@@ -31768,11 +31782,11 @@ var init_table3 = __esm({
31768
31782
  init_table();
31769
31783
  init_all2();
31770
31784
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
31771
- SQLiteTable = class extends (_e3 = Table2, _d3 = entityKind, _c6 = Table2.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table2.Symbol.ExtraConfigBuilder, _e3) {
31785
+ SQLiteTable = class extends (_e3 = Table2, _d3 = entityKind, _c7 = Table2.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table2.Symbol.ExtraConfigBuilder, _e3) {
31772
31786
  constructor() {
31773
31787
  super(...arguments);
31774
31788
  /** @internal */
31775
- __publicField(this, _c6);
31789
+ __publicField(this, _c7);
31776
31790
  /** @internal */
31777
31791
  __publicField(this, _b140, []);
31778
31792
  /** @internal */
@@ -33640,13 +33654,13 @@ var init_query_builders2 = __esm({
33640
33654
  });
33641
33655
 
33642
33656
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
33643
- var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
33657
+ var _a209, _b149, _c8, _SQLiteCountBuilder, SQLiteCountBuilder;
33644
33658
  var init_count2 = __esm({
33645
33659
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
33646
33660
  "use strict";
33647
33661
  init_entity();
33648
33662
  init_sql();
33649
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
33663
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c8 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c8) {
33650
33664
  constructor(params) {
33651
33665
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
33652
33666
  __publicField(this, "sql");
@@ -34418,7 +34432,8 @@ function getTableConfig2(table5) {
34418
34432
  const extraConfigBuilder = table5[SQLiteTable.Symbol.ExtraConfigBuilder];
34419
34433
  if (extraConfigBuilder !== void 0) {
34420
34434
  const extraConfig = extraConfigBuilder(table5[SQLiteTable.Symbol.Columns]);
34421
- for (const builder of Object.values(extraConfig)) {
34435
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
34436
+ for (const builder of Object.values(extraValues)) {
34422
34437
  if (is(builder, IndexBuilder2)) {
34423
34438
  indexes.push(builder.build(table5));
34424
34439
  } else if (is(builder, CheckBuilder2)) {
@@ -36315,6 +36330,18 @@ function text3(a, b = {}) {
36315
36330
  const { name: name2, config } = getColumnNameAndConfig(a, b);
36316
36331
  return new MySqlTextBuilder(name2, "text", config);
36317
36332
  }
36333
+ function tinytext(a, b = {}) {
36334
+ const { name: name2, config } = getColumnNameAndConfig(a, b);
36335
+ return new MySqlTextBuilder(name2, "tinytext", config);
36336
+ }
36337
+ function mediumtext(a, b = {}) {
36338
+ const { name: name2, config } = getColumnNameAndConfig(a, b);
36339
+ return new MySqlTextBuilder(name2, "mediumtext", config);
36340
+ }
36341
+ function longtext(a, b = {}) {
36342
+ const { name: name2, config } = getColumnNameAndConfig(a, b);
36343
+ return new MySqlTextBuilder(name2, "longtext", config);
36344
+ }
36318
36345
  var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
36319
36346
  var init_text3 = __esm({
36320
36347
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
@@ -36674,13 +36701,13 @@ var init_columns3 = __esm({
36674
36701
  });
36675
36702
 
36676
36703
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
36677
- var _a297, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
36704
+ var _a297, _b220, _c9, _MySqlCountBuilder, MySqlCountBuilder;
36678
36705
  var init_count3 = __esm({
36679
36706
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
36680
36707
  "use strict";
36681
36708
  init_entity();
36682
36709
  init_sql();
36683
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c8) {
36710
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c9) {
36684
36711
  constructor(params) {
36685
36712
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
36686
36713
  __publicField(this, "sql");
@@ -36856,7 +36883,10 @@ function getMySqlColumnBuilders() {
36856
36883
  tinyint,
36857
36884
  varbinary,
36858
36885
  varchar: varchar2,
36859
- year
36886
+ year,
36887
+ longtext,
36888
+ mediumtext,
36889
+ tinytext
36860
36890
  };
36861
36891
  }
36862
36892
  var init_all3 = __esm({
@@ -36910,7 +36940,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema5, baseName = n
36910
36940
  }
36911
36941
  return table5;
36912
36942
  }
36913
- var InlineForeignKeys3, _a299, _b222, _c9, _d4, _e4, MySqlTable, mysqlTable;
36943
+ var InlineForeignKeys3, _a299, _b222, _c10, _d4, _e4, MySqlTable, mysqlTable;
36914
36944
  var init_table4 = __esm({
36915
36945
  "../drizzle-orm/dist/mysql-core/table.js"() {
36916
36946
  "use strict";
@@ -36918,11 +36948,11 @@ var init_table4 = __esm({
36918
36948
  init_table();
36919
36949
  init_all3();
36920
36950
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
36921
- MySqlTable = class extends (_e4 = Table2, _d4 = entityKind, _c9 = Table2.Symbol.Columns, _b222 = InlineForeignKeys3, _a299 = Table2.Symbol.ExtraConfigBuilder, _e4) {
36951
+ MySqlTable = class extends (_e4 = Table2, _d4 = entityKind, _c10 = Table2.Symbol.Columns, _b222 = InlineForeignKeys3, _a299 = Table2.Symbol.ExtraConfigBuilder, _e4) {
36922
36952
  constructor() {
36923
36953
  super(...arguments);
36924
36954
  /** @internal */
36925
- __publicField(this, _c9);
36955
+ __publicField(this, _c10);
36926
36956
  /** @internal */
36927
36957
  __publicField(this, _b222, []);
36928
36958
  /** @internal */
@@ -37118,6 +37148,12 @@ var init_dialect3 = __esm({
37118
37148
  buildOrderBy(orderBy) {
37119
37149
  return orderBy && orderBy.length > 0 ? sql` order by ${sql.join(orderBy, sql`, `)}` : void 0;
37120
37150
  }
37151
+ buildIndex({
37152
+ indexes,
37153
+ indexFor
37154
+ }) {
37155
+ return indexes && indexes.length > 0 ? sql` ${sql.raw(indexFor)} INDEX (${sql.raw(indexes.join(`, `))})` : void 0;
37156
+ }
37121
37157
  buildSelectQuery({
37122
37158
  withList,
37123
37159
  fields,
@@ -37132,7 +37168,10 @@ var init_dialect3 = __esm({
37132
37168
  offset,
37133
37169
  lockingClause,
37134
37170
  distinct,
37135
- setOperators
37171
+ setOperators,
37172
+ useIndex,
37173
+ forceIndex,
37174
+ ignoreIndex
37136
37175
  }) {
37137
37176
  const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
37138
37177
  for (const f of fieldsList) {
@@ -37168,8 +37207,11 @@ var init_dialect3 = __esm({
37168
37207
  const tableSchema = table22[MySqlTable.Symbol.Schema];
37169
37208
  const origTableName = table22[MySqlTable.Symbol.OriginalName];
37170
37209
  const alias = tableName === origTableName ? void 0 : joinMeta.alias;
37210
+ const useIndexSql2 = this.buildIndex({ indexes: joinMeta.useIndex, indexFor: "USE" });
37211
+ const forceIndexSql2 = this.buildIndex({ indexes: joinMeta.forceIndex, indexFor: "FORCE" });
37212
+ const ignoreIndexSql2 = this.buildIndex({ indexes: joinMeta.ignoreIndex, indexFor: "IGNORE" });
37171
37213
  joinsArray.push(
37172
- sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`} on ${joinMeta.on}`
37214
+ sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${useIndexSql2}${forceIndexSql2}${ignoreIndexSql2}${alias && sql` ${sql.identifier(alias)}`} on ${joinMeta.on}`
37173
37215
  );
37174
37216
  } else if (is(table22, View3)) {
37175
37217
  const viewName = table22[ViewBaseConfig].name;
@@ -37196,6 +37238,9 @@ var init_dialect3 = __esm({
37196
37238
  const groupBySql = groupBy && groupBy.length > 0 ? sql` group by ${sql.join(groupBy, sql`, `)}` : void 0;
37197
37239
  const limitSql = this.buildLimit(limit);
37198
37240
  const offsetSql = offset ? sql` offset ${offset}` : void 0;
37241
+ const useIndexSql = this.buildIndex({ indexes: useIndex, indexFor: "USE" });
37242
+ const forceIndexSql = this.buildIndex({ indexes: forceIndex, indexFor: "FORCE" });
37243
+ const ignoreIndexSql = this.buildIndex({ indexes: ignoreIndex, indexFor: "IGNORE" });
37199
37244
  let lockingClausesSql;
37200
37245
  if (lockingClause) {
37201
37246
  const { config, strength } = lockingClause;
@@ -37206,7 +37251,7 @@ var init_dialect3 = __esm({
37206
37251
  lockingClausesSql.append(sql` skip locked`);
37207
37252
  }
37208
37253
  }
37209
- const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClausesSql}`;
37254
+ const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${useIndexSql}${forceIndexSql}${ignoreIndexSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClausesSql}`;
37210
37255
  if (setOperators.length > 0) {
37211
37256
  return this.buildSetOperations(finalQuery, setOperators);
37212
37257
  }
@@ -37774,6 +37819,183 @@ var init_dialect3 = __esm({
37774
37819
  }
37775
37820
  });
37776
37821
 
37822
+ // ../drizzle-orm/dist/mysql-core/indexes.js
37823
+ var _a302, IndexBuilderOn3, _a303, IndexBuilder3, _a304, Index5;
37824
+ var init_indexes3 = __esm({
37825
+ "../drizzle-orm/dist/mysql-core/indexes.js"() {
37826
+ "use strict";
37827
+ init_entity();
37828
+ _a302 = entityKind;
37829
+ IndexBuilderOn3 = class {
37830
+ constructor(name2, unique) {
37831
+ this.name = name2;
37832
+ this.unique = unique;
37833
+ }
37834
+ on(...columns) {
37835
+ return new IndexBuilder3(this.name, columns, this.unique);
37836
+ }
37837
+ };
37838
+ __publicField(IndexBuilderOn3, _a302, "MySqlIndexBuilderOn");
37839
+ _a303 = entityKind;
37840
+ IndexBuilder3 = class {
37841
+ constructor(name2, columns, unique) {
37842
+ /** @internal */
37843
+ __publicField(this, "config");
37844
+ this.config = {
37845
+ name: name2,
37846
+ columns,
37847
+ unique
37848
+ };
37849
+ }
37850
+ using(using) {
37851
+ this.config.using = using;
37852
+ return this;
37853
+ }
37854
+ algorythm(algorythm) {
37855
+ this.config.algorythm = algorythm;
37856
+ return this;
37857
+ }
37858
+ lock(lock) {
37859
+ this.config.lock = lock;
37860
+ return this;
37861
+ }
37862
+ /** @internal */
37863
+ build(table5) {
37864
+ return new Index5(this.config, table5);
37865
+ }
37866
+ };
37867
+ __publicField(IndexBuilder3, _a303, "MySqlIndexBuilder");
37868
+ _a304 = entityKind;
37869
+ Index5 = class {
37870
+ constructor(config, table5) {
37871
+ __publicField(this, "config");
37872
+ this.config = { ...config, table: table5 };
37873
+ }
37874
+ };
37875
+ __publicField(Index5, _a304, "MySqlIndex");
37876
+ }
37877
+ });
37878
+
37879
+ // ../drizzle-orm/dist/mysql-core/primary-keys.js
37880
+ var _a305, PrimaryKeyBuilder3, _a306, PrimaryKey3;
37881
+ var init_primary_keys3 = __esm({
37882
+ "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
37883
+ "use strict";
37884
+ init_entity();
37885
+ init_table4();
37886
+ _a305 = entityKind;
37887
+ PrimaryKeyBuilder3 = class {
37888
+ constructor(columns, name2) {
37889
+ /** @internal */
37890
+ __publicField(this, "columns");
37891
+ /** @internal */
37892
+ __publicField(this, "name");
37893
+ this.columns = columns;
37894
+ this.name = name2;
37895
+ }
37896
+ /** @internal */
37897
+ build(table5) {
37898
+ return new PrimaryKey3(table5, this.columns, this.name);
37899
+ }
37900
+ };
37901
+ __publicField(PrimaryKeyBuilder3, _a305, "MySqlPrimaryKeyBuilder");
37902
+ _a306 = entityKind;
37903
+ PrimaryKey3 = class {
37904
+ constructor(table5, columns, name2) {
37905
+ __publicField(this, "columns");
37906
+ __publicField(this, "name");
37907
+ this.table = table5;
37908
+ this.columns = columns;
37909
+ this.name = name2;
37910
+ }
37911
+ getName() {
37912
+ return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column5) => column5.name).join("_")}_pk`;
37913
+ }
37914
+ };
37915
+ __publicField(PrimaryKey3, _a306, "MySqlPrimaryKey");
37916
+ }
37917
+ });
37918
+
37919
+ // ../drizzle-orm/dist/mysql-core/view-common.js
37920
+ var MySqlViewConfig;
37921
+ var init_view_common3 = __esm({
37922
+ "../drizzle-orm/dist/mysql-core/view-common.js"() {
37923
+ "use strict";
37924
+ MySqlViewConfig = Symbol.for("drizzle:MySqlViewConfig");
37925
+ }
37926
+ });
37927
+
37928
+ // ../drizzle-orm/dist/mysql-core/utils.js
37929
+ function getTableConfig3(table5) {
37930
+ const columns = Object.values(table5[MySqlTable.Symbol.Columns]);
37931
+ const indexes = [];
37932
+ const checks = [];
37933
+ const primaryKeys = [];
37934
+ const uniqueConstraints = [];
37935
+ const foreignKeys = Object.values(table5[MySqlTable.Symbol.InlineForeignKeys]);
37936
+ const name2 = table5[Table2.Symbol.Name];
37937
+ const schema5 = table5[Table2.Symbol.Schema];
37938
+ const baseName = table5[Table2.Symbol.BaseName];
37939
+ const extraConfigBuilder = table5[MySqlTable.Symbol.ExtraConfigBuilder];
37940
+ if (extraConfigBuilder !== void 0) {
37941
+ const extraConfig = extraConfigBuilder(table5[MySqlTable.Symbol.Columns]);
37942
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
37943
+ for (const builder of Object.values(extraValues)) {
37944
+ if (is(builder, IndexBuilder3)) {
37945
+ indexes.push(builder.build(table5));
37946
+ } else if (is(builder, CheckBuilder3)) {
37947
+ checks.push(builder.build(table5));
37948
+ } else if (is(builder, UniqueConstraintBuilder3)) {
37949
+ uniqueConstraints.push(builder.build(table5));
37950
+ } else if (is(builder, PrimaryKeyBuilder3)) {
37951
+ primaryKeys.push(builder.build(table5));
37952
+ } else if (is(builder, ForeignKeyBuilder3)) {
37953
+ foreignKeys.push(builder.build(table5));
37954
+ }
37955
+ }
37956
+ }
37957
+ return {
37958
+ columns,
37959
+ indexes,
37960
+ foreignKeys,
37961
+ checks,
37962
+ primaryKeys,
37963
+ uniqueConstraints,
37964
+ name: name2,
37965
+ schema: schema5,
37966
+ baseName
37967
+ };
37968
+ }
37969
+ function getViewConfig3(view4) {
37970
+ return {
37971
+ ...view4[ViewBaseConfig],
37972
+ ...view4[MySqlViewConfig]
37973
+ };
37974
+ }
37975
+ function convertIndexToString(indexes) {
37976
+ return indexes.map((idx) => {
37977
+ return typeof idx === "object" ? idx.config.name : idx;
37978
+ });
37979
+ }
37980
+ function toArray(value) {
37981
+ return Array.isArray(value) ? value : [value];
37982
+ }
37983
+ var init_utils8 = __esm({
37984
+ "../drizzle-orm/dist/mysql-core/utils.js"() {
37985
+ "use strict";
37986
+ init_entity();
37987
+ init_table();
37988
+ init_view_common();
37989
+ init_checks3();
37990
+ init_foreign_keys3();
37991
+ init_indexes3();
37992
+ init_primary_keys3();
37993
+ init_table4();
37994
+ init_unique_constraint3();
37995
+ init_view_common3();
37996
+ }
37997
+ });
37998
+
37777
37999
  // ../drizzle-orm/dist/mysql-core/query-builders/select.js
37778
38000
  function createSetOperator3(type, isAll) {
37779
38001
  return (leftSelect, rightSelect, ...restSelects) => {
@@ -37792,11 +38014,12 @@ function createSetOperator3(type, isAll) {
37792
38014
  return leftSelect.addSetOperators(setOperators);
37793
38015
  };
37794
38016
  }
37795
- var _a302, MySqlSelectBuilder, _a303, _b224, MySqlSelectQueryBuilderBase, _a304, _b225, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
38017
+ var _a307, MySqlSelectBuilder, _a308, _b224, MySqlSelectQueryBuilderBase, _a309, _b225, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
37796
38018
  var init_select4 = __esm({
37797
38019
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
37798
38020
  "use strict";
37799
38021
  init_entity();
38022
+ init_table4();
37800
38023
  init_query_builder();
37801
38024
  init_query_promise();
37802
38025
  init_selection_proxy();
@@ -37804,10 +38027,10 @@ var init_select4 = __esm({
37804
38027
  init_subquery();
37805
38028
  init_table();
37806
38029
  init_utils2();
37807
- init_utils2();
37808
38030
  init_view_common();
38031
+ init_utils8();
37809
38032
  init_view_base3();
37810
- _a302 = entityKind;
38033
+ _a307 = entityKind;
37811
38034
  MySqlSelectBuilder = class {
37812
38035
  constructor(config) {
37813
38036
  __publicField(this, "fields");
@@ -37823,7 +38046,7 @@ var init_select4 = __esm({
37823
38046
  }
37824
38047
  this.distinct = config.distinct;
37825
38048
  }
37826
- from(source) {
38049
+ from(source, onIndex) {
37827
38050
  const isPartialSelect = !!this.fields;
37828
38051
  let fields;
37829
38052
  if (this.fields) {
@@ -37839,6 +38062,20 @@ var init_select4 = __esm({
37839
38062
  } else {
37840
38063
  fields = getTableColumns(source);
37841
38064
  }
38065
+ let useIndex = [];
38066
+ let forceIndex = [];
38067
+ let ignoreIndex = [];
38068
+ if (is(source, MySqlTable) && onIndex && typeof onIndex !== "string") {
38069
+ if (onIndex.useIndex) {
38070
+ useIndex = convertIndexToString(toArray(onIndex.useIndex));
38071
+ }
38072
+ if (onIndex.forceIndex) {
38073
+ forceIndex = convertIndexToString(toArray(onIndex.forceIndex));
38074
+ }
38075
+ if (onIndex.ignoreIndex) {
38076
+ ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex));
38077
+ }
38078
+ }
37842
38079
  return new MySqlSelectBase(
37843
38080
  {
37844
38081
  table: source,
@@ -37847,14 +38084,17 @@ var init_select4 = __esm({
37847
38084
  session: this.session,
37848
38085
  dialect: this.dialect,
37849
38086
  withList: this.withList,
37850
- distinct: this.distinct
38087
+ distinct: this.distinct,
38088
+ useIndex,
38089
+ forceIndex,
38090
+ ignoreIndex
37851
38091
  }
37852
38092
  );
37853
38093
  }
37854
38094
  };
37855
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
37856
- MySqlSelectQueryBuilderBase = class extends (_b224 = TypedQueryBuilder, _a303 = entityKind, _b224) {
37857
- constructor({ table: table5, fields, isPartialSelect, session, dialect: dialect6, withList, distinct }) {
38095
+ __publicField(MySqlSelectBuilder, _a307, "MySqlSelectBuilder");
38096
+ MySqlSelectQueryBuilderBase = class extends (_b224 = TypedQueryBuilder, _a308 = entityKind, _b224) {
38097
+ constructor({ table: table5, fields, isPartialSelect, session, dialect: dialect6, withList, distinct, useIndex, forceIndex, ignoreIndex }) {
37858
38098
  super();
37859
38099
  __publicField(this, "_");
37860
38100
  __publicField(this, "config");
@@ -37889,6 +38129,16 @@ var init_select4 = __esm({
37889
38129
  * })
37890
38130
  * .from(users)
37891
38131
  * .leftJoin(pets, eq(users.id, pets.ownerId))
38132
+ *
38133
+ * // Select userId and petId with use index hint
38134
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38135
+ * userId: users.id,
38136
+ * petId: pets.id,
38137
+ * })
38138
+ * .from(users)
38139
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38140
+ * useIndex: ['pets_owner_id_index']
38141
+ * })
37892
38142
  * ```
37893
38143
  */
37894
38144
  __publicField(this, "leftJoin", this.createJoin("left"));
@@ -37917,6 +38167,16 @@ var init_select4 = __esm({
37917
38167
  * })
37918
38168
  * .from(users)
37919
38169
  * .rightJoin(pets, eq(users.id, pets.ownerId))
38170
+ *
38171
+ * // Select userId and petId with use index hint
38172
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38173
+ * userId: users.id,
38174
+ * petId: pets.id,
38175
+ * })
38176
+ * .from(users)
38177
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38178
+ * useIndex: ['pets_owner_id_index']
38179
+ * })
37920
38180
  * ```
37921
38181
  */
37922
38182
  __publicField(this, "rightJoin", this.createJoin("right"));
@@ -37945,6 +38205,16 @@ var init_select4 = __esm({
37945
38205
  * })
37946
38206
  * .from(users)
37947
38207
  * .innerJoin(pets, eq(users.id, pets.ownerId))
38208
+ *
38209
+ * // Select userId and petId with use index hint
38210
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38211
+ * userId: users.id,
38212
+ * petId: pets.id,
38213
+ * })
38214
+ * .from(users)
38215
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38216
+ * useIndex: ['pets_owner_id_index']
38217
+ * })
37948
38218
  * ```
37949
38219
  */
37950
38220
  __publicField(this, "innerJoin", this.createJoin("inner"));
@@ -37973,6 +38243,16 @@ var init_select4 = __esm({
37973
38243
  * })
37974
38244
  * .from(users)
37975
38245
  * .fullJoin(pets, eq(users.id, pets.ownerId))
38246
+ *
38247
+ * // Select userId and petId with use index hint
38248
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38249
+ * userId: users.id,
38250
+ * petId: pets.id,
38251
+ * })
38252
+ * .from(users)
38253
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38254
+ * useIndex: ['pets_owner_id_index']
38255
+ * })
37976
38256
  * ```
37977
38257
  */
37978
38258
  __publicField(this, "fullJoin", this.createJoin("full"));
@@ -38167,7 +38447,10 @@ var init_select4 = __esm({
38167
38447
  table: table5,
38168
38448
  fields: { ...fields },
38169
38449
  distinct,
38170
- setOperators: []
38450
+ setOperators: [],
38451
+ useIndex,
38452
+ forceIndex,
38453
+ ignoreIndex
38171
38454
  };
38172
38455
  this.isPartialSelect = isPartialSelect;
38173
38456
  this.session = session;
@@ -38179,7 +38462,7 @@ var init_select4 = __esm({
38179
38462
  this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
38180
38463
  }
38181
38464
  createJoin(joinType) {
38182
- return (table5, on) => {
38465
+ return (table5, on, onIndex) => {
38183
38466
  const baseTableName = this.tableName;
38184
38467
  const tableName = getTableLikeName(table5);
38185
38468
  if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
@@ -38207,7 +38490,21 @@ var init_select4 = __esm({
38207
38490
  if (!this.config.joins) {
38208
38491
  this.config.joins = [];
38209
38492
  }
38210
- this.config.joins.push({ on, table: table5, joinType, alias: tableName });
38493
+ let useIndex = [];
38494
+ let forceIndex = [];
38495
+ let ignoreIndex = [];
38496
+ if (is(table5, MySqlTable) && onIndex && typeof onIndex !== "string") {
38497
+ if (onIndex.useIndex) {
38498
+ useIndex = convertIndexToString(toArray(onIndex.useIndex));
38499
+ }
38500
+ if (onIndex.forceIndex) {
38501
+ forceIndex = convertIndexToString(toArray(onIndex.forceIndex));
38502
+ }
38503
+ if (onIndex.ignoreIndex) {
38504
+ ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex));
38505
+ }
38506
+ }
38507
+ this.config.joins.push({ on, table: table5, joinType, alias: tableName, useIndex, forceIndex, ignoreIndex });
38211
38508
  if (typeof tableName === "string") {
38212
38509
  switch (joinType) {
38213
38510
  case "left": {
@@ -38454,8 +38751,8 @@ var init_select4 = __esm({
38454
38751
  return this;
38455
38752
  }
38456
38753
  };
38457
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
38458
- MySqlSelectBase = class extends (_b225 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b225) {
38754
+ __publicField(MySqlSelectQueryBuilderBase, _a308, "MySqlSelectQueryBuilder");
38755
+ MySqlSelectBase = class extends (_b225 = MySqlSelectQueryBuilderBase, _a309 = entityKind, _b225) {
38459
38756
  constructor() {
38460
38757
  super(...arguments);
38461
38758
  __publicField(this, "execute", (placeholderValues) => {
@@ -38479,7 +38776,7 @@ var init_select4 = __esm({
38479
38776
  return query;
38480
38777
  }
38481
38778
  };
38482
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
38779
+ __publicField(MySqlSelectBase, _a309, "MySqlSelect");
38483
38780
  applyMixins(MySqlSelectBase, [QueryPromise]);
38484
38781
  getMySqlSetOperators = () => ({
38485
38782
  union: union3,
@@ -38499,7 +38796,7 @@ var init_select4 = __esm({
38499
38796
  });
38500
38797
 
38501
38798
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
38502
- var _a305, QueryBuilder3;
38799
+ var _a310, QueryBuilder3;
38503
38800
  var init_query_builder4 = __esm({
38504
38801
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
38505
38802
  "use strict";
@@ -38508,7 +38805,7 @@ var init_query_builder4 = __esm({
38508
38805
  init_selection_proxy();
38509
38806
  init_subquery();
38510
38807
  init_select4();
38511
- _a305 = entityKind;
38808
+ _a310 = entityKind;
38512
38809
  QueryBuilder3 = class {
38513
38810
  constructor(dialect6) {
38514
38811
  __publicField(this, "dialect");
@@ -38570,12 +38867,12 @@ var init_query_builder4 = __esm({
38570
38867
  return this.dialect;
38571
38868
  }
38572
38869
  };
38573
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
38870
+ __publicField(QueryBuilder3, _a310, "MySqlQueryBuilder");
38574
38871
  }
38575
38872
  });
38576
38873
 
38577
38874
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
38578
- var _a306, MySqlInsertBuilder, _a307, _b226, MySqlInsertBase;
38875
+ var _a311, MySqlInsertBuilder, _a312, _b226, MySqlInsertBase;
38579
38876
  var init_insert3 = __esm({
38580
38877
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
38581
38878
  "use strict";
@@ -38585,7 +38882,7 @@ var init_insert3 = __esm({
38585
38882
  init_table();
38586
38883
  init_utils2();
38587
38884
  init_query_builder4();
38588
- _a306 = entityKind;
38885
+ _a311 = entityKind;
38589
38886
  MySqlInsertBuilder = class {
38590
38887
  constructor(table5, session, dialect6) {
38591
38888
  __publicField(this, "shouldIgnore", false);
@@ -38623,8 +38920,8 @@ var init_insert3 = __esm({
38623
38920
  return new MySqlInsertBase(this.table, select, this.shouldIgnore, this.session, this.dialect, true);
38624
38921
  }
38625
38922
  };
38626
- __publicField(MySqlInsertBuilder, _a306, "MySqlInsertBuilder");
38627
- MySqlInsertBase = class extends (_b226 = QueryPromise, _a307 = entityKind, _b226) {
38923
+ __publicField(MySqlInsertBuilder, _a311, "MySqlInsertBuilder");
38924
+ MySqlInsertBase = class extends (_b226 = QueryPromise, _a312 = entityKind, _b226) {
38628
38925
  constructor(table5, values, ignore, session, dialect6, select) {
38629
38926
  super();
38630
38927
  __publicField(this, "config");
@@ -38705,7 +39002,7 @@ var init_insert3 = __esm({
38705
39002
  return this;
38706
39003
  }
38707
39004
  };
38708
- __publicField(MySqlInsertBase, _a307, "MySqlInsert");
39005
+ __publicField(MySqlInsertBase, _a312, "MySqlInsert");
38709
39006
  }
38710
39007
  });
38711
39008
 
@@ -38717,7 +39014,7 @@ var init_select_types3 = __esm({
38717
39014
  });
38718
39015
 
38719
39016
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
38720
- var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
39017
+ var _a313, MySqlUpdateBuilder, _a314, _b227, MySqlUpdateBase;
38721
39018
  var init_update3 = __esm({
38722
39019
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
38723
39020
  "use strict";
@@ -38726,7 +39023,7 @@ var init_update3 = __esm({
38726
39023
  init_selection_proxy();
38727
39024
  init_table();
38728
39025
  init_utils2();
38729
- _a308 = entityKind;
39026
+ _a313 = entityKind;
38730
39027
  MySqlUpdateBuilder = class {
38731
39028
  constructor(table5, session, dialect6, withList) {
38732
39029
  this.table = table5;
@@ -38738,8 +39035,8 @@ var init_update3 = __esm({
38738
39035
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
38739
39036
  }
38740
39037
  };
38741
- __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
38742
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
39038
+ __publicField(MySqlUpdateBuilder, _a313, "MySqlUpdateBuilder");
39039
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a314 = entityKind, _b227) {
38743
39040
  constructor(table5, set, session, dialect6, withList) {
38744
39041
  super();
38745
39042
  __publicField(this, "config");
@@ -38832,7 +39129,7 @@ var init_update3 = __esm({
38832
39129
  return this;
38833
39130
  }
38834
39131
  };
38835
- __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
39132
+ __publicField(MySqlUpdateBase, _a314, "MySqlUpdate");
38836
39133
  }
38837
39134
  });
38838
39135
 
@@ -38850,14 +39147,14 @@ var init_query_builders3 = __esm({
38850
39147
  });
38851
39148
 
38852
39149
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
38853
- var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
39150
+ var _a315, RelationalQueryBuilder3, _a316, _b228, MySqlRelationalQuery;
38854
39151
  var init_query3 = __esm({
38855
39152
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
38856
39153
  "use strict";
38857
39154
  init_entity();
38858
39155
  init_query_promise();
38859
39156
  init_relations();
38860
- _a310 = entityKind;
39157
+ _a315 = entityKind;
38861
39158
  RelationalQueryBuilder3 = class {
38862
39159
  constructor(fullSchema, schema5, tableNamesMap, table5, tableConfig, dialect6, session, mode) {
38863
39160
  this.fullSchema = fullSchema;
@@ -38898,8 +39195,8 @@ var init_query3 = __esm({
38898
39195
  );
38899
39196
  }
38900
39197
  };
38901
- __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
38902
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
39198
+ __publicField(RelationalQueryBuilder3, _a315, "MySqlRelationalQueryBuilder");
39199
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a316 = entityKind, _b228) {
38903
39200
  constructor(fullSchema, schema5, tableNamesMap, table5, tableConfig, dialect6, session, config, queryMode, mode) {
38904
39201
  super();
38905
39202
  this.fullSchema = fullSchema;
@@ -38963,12 +39260,12 @@ var init_query3 = __esm({
38963
39260
  return this.prepare().execute();
38964
39261
  }
38965
39262
  };
38966
- __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
39263
+ __publicField(MySqlRelationalQuery, _a316, "MySqlRelationalQuery");
38967
39264
  }
38968
39265
  });
38969
39266
 
38970
39267
  // ../drizzle-orm/dist/mysql-core/db.js
38971
- var _a312, MySqlDatabase;
39268
+ var _a317, MySqlDatabase;
38972
39269
  var init_db3 = __esm({
38973
39270
  "../drizzle-orm/dist/mysql-core/db.js"() {
38974
39271
  "use strict";
@@ -38979,7 +39276,7 @@ var init_db3 = __esm({
38979
39276
  init_count3();
38980
39277
  init_query_builders3();
38981
39278
  init_query3();
38982
- _a312 = entityKind;
39279
+ _a317 = entityKind;
38983
39280
  MySqlDatabase = class {
38984
39281
  constructor(dialect6, session, schema5, mode) {
38985
39282
  __publicField(this, "query");
@@ -39192,113 +39489,7 @@ var init_db3 = __esm({
39192
39489
  return this.session.transaction(transaction, config);
39193
39490
  }
39194
39491
  };
39195
- __publicField(MySqlDatabase, _a312, "MySqlDatabase");
39196
- }
39197
- });
39198
-
39199
- // ../drizzle-orm/dist/mysql-core/indexes.js
39200
- var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
39201
- var init_indexes3 = __esm({
39202
- "../drizzle-orm/dist/mysql-core/indexes.js"() {
39203
- "use strict";
39204
- init_entity();
39205
- _a313 = entityKind;
39206
- IndexBuilderOn3 = class {
39207
- constructor(name2, unique) {
39208
- this.name = name2;
39209
- this.unique = unique;
39210
- }
39211
- on(...columns) {
39212
- return new IndexBuilder3(this.name, columns, this.unique);
39213
- }
39214
- };
39215
- __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
39216
- _a314 = entityKind;
39217
- IndexBuilder3 = class {
39218
- constructor(name2, columns, unique) {
39219
- /** @internal */
39220
- __publicField(this, "config");
39221
- this.config = {
39222
- name: name2,
39223
- columns,
39224
- unique
39225
- };
39226
- }
39227
- using(using) {
39228
- this.config.using = using;
39229
- return this;
39230
- }
39231
- algorythm(algorythm) {
39232
- this.config.algorythm = algorythm;
39233
- return this;
39234
- }
39235
- lock(lock) {
39236
- this.config.lock = lock;
39237
- return this;
39238
- }
39239
- /** @internal */
39240
- build(table5) {
39241
- return new Index5(this.config, table5);
39242
- }
39243
- };
39244
- __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
39245
- _a315 = entityKind;
39246
- Index5 = class {
39247
- constructor(config, table5) {
39248
- __publicField(this, "config");
39249
- this.config = { ...config, table: table5 };
39250
- }
39251
- };
39252
- __publicField(Index5, _a315, "MySqlIndex");
39253
- }
39254
- });
39255
-
39256
- // ../drizzle-orm/dist/mysql-core/primary-keys.js
39257
- var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
39258
- var init_primary_keys3 = __esm({
39259
- "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
39260
- "use strict";
39261
- init_entity();
39262
- init_table4();
39263
- _a316 = entityKind;
39264
- PrimaryKeyBuilder3 = class {
39265
- constructor(columns, name2) {
39266
- /** @internal */
39267
- __publicField(this, "columns");
39268
- /** @internal */
39269
- __publicField(this, "name");
39270
- this.columns = columns;
39271
- this.name = name2;
39272
- }
39273
- /** @internal */
39274
- build(table5) {
39275
- return new PrimaryKey3(table5, this.columns, this.name);
39276
- }
39277
- };
39278
- __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
39279
- _a317 = entityKind;
39280
- PrimaryKey3 = class {
39281
- constructor(table5, columns, name2) {
39282
- __publicField(this, "columns");
39283
- __publicField(this, "name");
39284
- this.table = table5;
39285
- this.columns = columns;
39286
- this.name = name2;
39287
- }
39288
- getName() {
39289
- return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column5) => column5.name).join("_")}_pk`;
39290
- }
39291
- };
39292
- __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
39293
- }
39294
- });
39295
-
39296
- // ../drizzle-orm/dist/mysql-core/view-common.js
39297
- var MySqlViewConfig;
39298
- var init_view_common3 = __esm({
39299
- "../drizzle-orm/dist/mysql-core/view-common.js"() {
39300
- "use strict";
39301
- MySqlViewConfig = Symbol.for("drizzle:MySqlViewConfig");
39492
+ __publicField(MySqlDatabase, _a317, "MySqlDatabase");
39302
39493
  }
39303
39494
  });
39304
39495
 
@@ -39309,7 +39500,7 @@ function mysqlViewWithSchema(name2, selection, schema5) {
39309
39500
  }
39310
39501
  return new ViewBuilder3(name2, schema5);
39311
39502
  }
39312
- var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c10, MySqlView2;
39503
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c11, MySqlView2;
39313
39504
  var init_view3 = __esm({
39314
39505
  "../drizzle-orm/dist/mysql-core/view.js"() {
39315
39506
  "use strict";
@@ -39414,7 +39605,7 @@ var init_view3 = __esm({
39414
39605
  }
39415
39606
  };
39416
39607
  __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
39417
- MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c10) {
39608
+ MySqlView2 = class extends (_c11 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c11) {
39418
39609
  constructor({ mysqlConfig, config }) {
39419
39610
  super(config);
39420
39611
  __publicField(this, _a321);
@@ -39523,68 +39714,6 @@ var init_subquery4 = __esm({
39523
39714
  }
39524
39715
  });
39525
39716
 
39526
- // ../drizzle-orm/dist/mysql-core/utils.js
39527
- function getTableConfig3(table5) {
39528
- const columns = Object.values(table5[MySqlTable.Symbol.Columns]);
39529
- const indexes = [];
39530
- const checks = [];
39531
- const primaryKeys = [];
39532
- const uniqueConstraints = [];
39533
- const foreignKeys = Object.values(table5[MySqlTable.Symbol.InlineForeignKeys]);
39534
- const name2 = table5[Table2.Symbol.Name];
39535
- const schema5 = table5[Table2.Symbol.Schema];
39536
- const baseName = table5[Table2.Symbol.BaseName];
39537
- const extraConfigBuilder = table5[MySqlTable.Symbol.ExtraConfigBuilder];
39538
- if (extraConfigBuilder !== void 0) {
39539
- const extraConfig = extraConfigBuilder(table5[MySqlTable.Symbol.Columns]);
39540
- for (const builder of Object.values(extraConfig)) {
39541
- if (is(builder, IndexBuilder3)) {
39542
- indexes.push(builder.build(table5));
39543
- } else if (is(builder, CheckBuilder3)) {
39544
- checks.push(builder.build(table5));
39545
- } else if (is(builder, UniqueConstraintBuilder3)) {
39546
- uniqueConstraints.push(builder.build(table5));
39547
- } else if (is(builder, PrimaryKeyBuilder3)) {
39548
- primaryKeys.push(builder.build(table5));
39549
- } else if (is(builder, ForeignKeyBuilder3)) {
39550
- foreignKeys.push(builder.build(table5));
39551
- }
39552
- }
39553
- }
39554
- return {
39555
- columns,
39556
- indexes,
39557
- foreignKeys,
39558
- checks,
39559
- primaryKeys,
39560
- uniqueConstraints,
39561
- name: name2,
39562
- schema: schema5,
39563
- baseName
39564
- };
39565
- }
39566
- function getViewConfig3(view4) {
39567
- return {
39568
- ...view4[ViewBaseConfig],
39569
- ...view4[MySqlViewConfig]
39570
- };
39571
- }
39572
- var init_utils8 = __esm({
39573
- "../drizzle-orm/dist/mysql-core/utils.js"() {
39574
- "use strict";
39575
- init_entity();
39576
- init_table();
39577
- init_view_common();
39578
- init_checks3();
39579
- init_foreign_keys3();
39580
- init_indexes3();
39581
- init_primary_keys3();
39582
- init_table4();
39583
- init_unique_constraint3();
39584
- init_view_common3();
39585
- }
39586
- });
39587
-
39588
39717
  // ../drizzle-orm/dist/mysql-core/index.js
39589
39718
  var init_mysql_core = __esm({
39590
39719
  "../drizzle-orm/dist/mysql-core/index.js"() {
@@ -42069,13 +42198,13 @@ var init_columns4 = __esm({
42069
42198
  });
42070
42199
 
42071
42200
  // ../drizzle-orm/dist/singlestore-core/query-builders/count.js
42072
- var _a391, _b295, _c11, _SingleStoreCountBuilder, SingleStoreCountBuilder;
42201
+ var _a391, _b295, _c12, _SingleStoreCountBuilder, SingleStoreCountBuilder;
42073
42202
  var init_count4 = __esm({
42074
42203
  "../drizzle-orm/dist/singlestore-core/query-builders/count.js"() {
42075
42204
  "use strict";
42076
42205
  init_entity();
42077
42206
  init_sql();
42078
- _SingleStoreCountBuilder = class _SingleStoreCountBuilder extends (_c11 = SQL, _b295 = entityKind, _a391 = Symbol.toStringTag, _c11) {
42207
+ _SingleStoreCountBuilder = class _SingleStoreCountBuilder extends (_c12 = SQL, _b295 = entityKind, _a391 = Symbol.toStringTag, _c12) {
42079
42208
  constructor(params) {
42080
42209
  super(_SingleStoreCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
42081
42210
  __publicField(this, "sql");
@@ -42429,14 +42558,14 @@ function singlestoreTableWithSchema(name2, columns, extraConfig, schema5, baseNa
42429
42558
  }
42430
42559
  return table5;
42431
42560
  }
42432
- var _a395, _b298, _c12, _d5, SingleStoreTable;
42561
+ var _a395, _b298, _c13, _d5, SingleStoreTable;
42433
42562
  var init_table5 = __esm({
42434
42563
  "../drizzle-orm/dist/singlestore-core/table.js"() {
42435
42564
  "use strict";
42436
42565
  init_entity();
42437
42566
  init_table();
42438
42567
  init_all4();
42439
- SingleStoreTable = class extends (_d5 = Table2, _c12 = entityKind, _b298 = Table2.Symbol.Columns, _a395 = Table2.Symbol.ExtraConfigBuilder, _d5) {
42568
+ SingleStoreTable = class extends (_d5 = Table2, _c13 = entityKind, _b298 = Table2.Symbol.Columns, _a395 = Table2.Symbol.ExtraConfigBuilder, _d5) {
42440
42569
  constructor() {
42441
42570
  super(...arguments);
42442
42571
  /** @internal */
@@ -42445,7 +42574,7 @@ var init_table5 = __esm({
42445
42574
  __publicField(this, _a395);
42446
42575
  }
42447
42576
  };
42448
- __publicField(SingleStoreTable, _c12, "SingleStoreTable");
42577
+ __publicField(SingleStoreTable, _c13, "SingleStoreTable");
42449
42578
  /** @internal */
42450
42579
  __publicField(SingleStoreTable, "Symbol", Object.assign({}, Table2.Symbol, {}));
42451
42580
  }
@@ -44344,7 +44473,8 @@ function getTableConfig4(table5) {
44344
44473
  const extraConfigBuilder = table5[SingleStoreTable.Symbol.ExtraConfigBuilder];
44345
44474
  if (extraConfigBuilder !== void 0) {
44346
44475
  const extraConfig = extraConfigBuilder(table5[SingleStoreTable.Symbol.Columns]);
44347
- for (const builder of Object.values(extraConfig)) {
44476
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
44477
+ for (const builder of Object.values(extraValues)) {
44348
44478
  if (is(builder, IndexBuilder4)) {
44349
44479
  indexes.push(builder.build(table5));
44350
44480
  } else if (is(builder, UniqueConstraintBuilder4)) {