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.mjs CHANGED
@@ -5700,8 +5700,8 @@ var init_lib = __esm({
5700
5700
  unknownKeys: "strict",
5701
5701
  ...message !== void 0 ? {
5702
5702
  errorMap: (issue, ctx) => {
5703
- var _a413, _b303, _c13, _d6;
5704
- 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;
5703
+ var _a413, _b303, _c14, _d6;
5704
+ 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;
5705
5705
  if (issue.code === "unrecognized_keys")
5706
5706
  return {
5707
5707
  message: (_d6 = errorUtil.errToObj(message).message) !== null && _d6 !== void 0 ? _d6 : defaultError
@@ -12336,7 +12336,7 @@ var init_sqlgenerator = __esm({
12336
12336
  const { tableName, schema: schema5, columns, compositePKs, uniqueConstraints, checkConstraints, policies, isRLSEnabled } = st;
12337
12337
  let statement = "";
12338
12338
  const name2 = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
12339
- statement += `CREATE TABLE IF NOT EXISTS ${name2} (
12339
+ statement += `CREATE TABLE ${name2} (
12340
12340
  `;
12341
12341
  for (let i = 0; i < columns.length; i++) {
12342
12342
  const column5 = columns[i];
@@ -13174,7 +13174,7 @@ WITH ${withCheckOption} CHECK OPTION` : "";
13174
13174
  convert(statement) {
13175
13175
  const { tableName, columnName, schema: schema5 } = statement;
13176
13176
  const tableNameWithSchema = schema5 ? `"${schema5}"."${tableName}"` : `"${tableName}"`;
13177
- return `ALTER TABLE ${tableNameWithSchema} DROP COLUMN IF EXISTS "${columnName}";`;
13177
+ return `ALTER TABLE ${tableNameWithSchema} DROP COLUMN "${columnName}";`;
13178
13178
  }
13179
13179
  };
13180
13180
  MySqlAlterTableDropColumnConvertor = class extends Convertor {
@@ -13595,7 +13595,7 @@ WITH ${withCheckOption} CHECK OPTION` : "";
13595
13595
  for (const table5 of Object.values(json22.tables)) {
13596
13596
  for (const index5 of Object.values(table5.indexes)) {
13597
13597
  const unsquashed = SQLiteSquasher.unsquashIdx(index5);
13598
- sqlStatements.push(`DROP INDEX IF EXISTS "${unsquashed.name}";`);
13598
+ sqlStatements.push(`DROP INDEX "${unsquashed.name}";`);
13599
13599
  indexes.push({ ...unsquashed, tableName: table5.name });
13600
13600
  }
13601
13601
  }
@@ -14109,13 +14109,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
14109
14109
  const toColumnsString = columnsTo.map((it) => `"${it}"`).join(",");
14110
14110
  const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${tableFrom}"` : `"${tableFrom}"`;
14111
14111
  const tableToNameWithSchema = schemaTo ? `"${schemaTo}"."${tableTo}"` : `"${tableTo}"`;
14112
- const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name2}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
14113
- let sql2 = "DO $$ BEGIN\n";
14114
- sql2 += " " + alterStatement + ";\n";
14115
- sql2 += "EXCEPTION\n";
14116
- sql2 += " WHEN duplicate_object THEN null;\n";
14117
- sql2 += "END $$;\n";
14118
- return sql2;
14112
+ const alterStatement = `ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${name2}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement};`;
14113
+ return alterStatement;
14119
14114
  }
14120
14115
  };
14121
14116
  LibSQLCreateForeignKeyConvertor = class extends Convertor {
@@ -14172,12 +14167,8 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
14172
14167
  const toColumnsString = newFk.columnsTo.map((it) => `"${it}"`).join(",");
14173
14168
  const tableFromNameWithSchema = oldFk.schemaTo ? `"${oldFk.schemaTo}"."${oldFk.tableFrom}"` : `"${oldFk.tableFrom}"`;
14174
14169
  const tableToNameWithSchema = newFk.schemaTo ? `"${newFk.schemaTo}"."${newFk.tableFrom}"` : `"${newFk.tableFrom}"`;
14175
- const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement}`;
14176
- sql2 += "DO $$ BEGIN\n";
14177
- sql2 += " " + alterStatement + ";\n";
14178
- sql2 += "EXCEPTION\n";
14179
- sql2 += " WHEN duplicate_object THEN null;\n";
14180
- sql2 += "END $$;\n";
14170
+ const alterStatement = `ALTER TABLE ${tableFromNameWithSchema} ADD CONSTRAINT "${newFk.name}" FOREIGN KEY (${fromColumnsString}) REFERENCES ${tableToNameWithSchema}(${toColumnsString})${onDeleteStatement}${onUpdateStatement};`;
14171
+ sql2 += alterStatement;
14181
14172
  return sql2;
14182
14173
  }
14183
14174
  };
@@ -14233,7 +14224,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
14233
14224
  reversedString = reversedString.slice(0, -1);
14234
14225
  return reversedString;
14235
14226
  }
14236
- 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}` : ""};`;
14227
+ return `CREATE ${indexPart}${concurrently ? " CONCURRENTLY" : ""} "${name2}" ON ${tableNameWithSchema} USING ${method} (${value})${Object.keys(withMap).length !== 0 ? ` WITH (${reverseLogic(withMap)})` : ""}${where ? ` WHERE ${where}` : ""};`;
14237
14228
  }
14238
14229
  };
14239
14230
  CreateMySqlIndexConvertor = class extends Convertor {
@@ -14288,7 +14279,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
14288
14279
  }
14289
14280
  convert(statement) {
14290
14281
  const { name: name2 } = PgSquasher.unsquashIdx(statement.data);
14291
- return `DROP INDEX IF EXISTS "${name2}";`;
14282
+ return `DROP INDEX "${name2}";`;
14292
14283
  }
14293
14284
  };
14294
14285
  PgCreateSchemaConvertor = class extends Convertor {
@@ -14359,7 +14350,7 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT "${statement.newC
14359
14350
  }
14360
14351
  convert(statement) {
14361
14352
  const { name: name2 } = PgSquasher.unsquashIdx(statement.data);
14362
- return `DROP INDEX IF EXISTS \`${name2}\`;`;
14353
+ return `DROP INDEX \`${name2}\`;`;
14363
14354
  }
14364
14355
  };
14365
14356
  MySqlDropIndexConvertor = class extends Convertor {
@@ -21988,7 +21979,7 @@ var version;
21988
21979
  var init_version = __esm({
21989
21980
  "../drizzle-orm/dist/version.js"() {
21990
21981
  "use strict";
21991
- version = "0.37.0";
21982
+ version = "0.38.0";
21992
21983
  }
21993
21984
  });
21994
21985
 
@@ -22173,7 +22164,10 @@ function fillPlaceholders(params, values) {
22173
22164
  return p;
22174
22165
  });
22175
22166
  }
22176
- var _a19, FakePrimitiveParam, _a20, StringChunk, _a21, _SQL, SQL, _a22, Name, noopDecoder, noopEncoder, noopMapper, _a23, Param, _a24, Placeholder, _a25, _b10, View3;
22167
+ function isView(view4) {
22168
+ return typeof view4 === "object" && view4 !== null && IsDrizzleView in view4;
22169
+ }
22170
+ var _a19, FakePrimitiveParam, _a20, StringChunk, _a21, _SQL, SQL, _a22, Name, noopDecoder, noopEncoder, noopMapper, _a23, Param, _a24, Placeholder, IsDrizzleView, _a25, _b10, _c2, View3;
22177
22171
  var init_sql = __esm({
22178
22172
  "../drizzle-orm/dist/sql/sql.js"() {
22179
22173
  "use strict";
@@ -22498,11 +22492,14 @@ var init_sql = __esm({
22498
22492
  }
22499
22493
  };
22500
22494
  __publicField(Placeholder, _a24, "Placeholder");
22501
- _b10 = entityKind, _a25 = ViewBaseConfig;
22495
+ IsDrizzleView = Symbol.for("drizzle:IsDrizzleView");
22496
+ _c2 = entityKind, _b10 = ViewBaseConfig, _a25 = IsDrizzleView;
22502
22497
  View3 = class {
22503
22498
  constructor({ name: name2, schema: schema5, selectedFields, query }) {
22504
22499
  /** @internal */
22505
- __publicField(this, _a25);
22500
+ __publicField(this, _b10);
22501
+ /** @internal */
22502
+ __publicField(this, _a25, true);
22506
22503
  this[ViewBaseConfig] = {
22507
22504
  name: name2,
22508
22505
  originalName: name2,
@@ -22517,7 +22514,7 @@ var init_sql = __esm({
22517
22514
  return new SQL([this]);
22518
22515
  }
22519
22516
  };
22520
- __publicField(View3, _b10, "View");
22517
+ __publicField(View3, _c2, "View");
22521
22518
  Column2.prototype.getSQL = function() {
22522
22519
  return new SQL([this]);
22523
22520
  };
@@ -23038,6 +23035,9 @@ function applyMixins(baseClass, extendedClasses) {
23038
23035
  function getTableColumns(table5) {
23039
23036
  return table5[Table2.Symbol.Columns];
23040
23037
  }
23038
+ function getViewSelectedFields(view4) {
23039
+ return view4[ViewBaseConfig].selectedFields;
23040
+ }
23041
23041
  function getTableLikeName(table5) {
23042
23042
  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];
23043
23043
  }
@@ -23332,7 +23332,10 @@ var init_char = __esm({
23332
23332
  }
23333
23333
  /** @internal */
23334
23334
  build(table5) {
23335
- return new PgChar(table5, this.config);
23335
+ return new PgChar(
23336
+ table5,
23337
+ this.config
23338
+ );
23336
23339
  }
23337
23340
  };
23338
23341
  __publicField(PgCharBuilder, _a46, "PgCharBuilder");
@@ -24464,7 +24467,10 @@ var init_varchar = __esm({
24464
24467
  }
24465
24468
  /** @internal */
24466
24469
  build(table5) {
24467
- return new PgVarchar(table5, this.config);
24470
+ return new PgVarchar(
24471
+ table5,
24472
+ this.config
24473
+ );
24468
24474
  }
24469
24475
  };
24470
24476
  __publicField(PgVarcharBuilder, _a105, "PgVarcharBuilder");
@@ -24624,7 +24630,10 @@ var init_vector = __esm({
24624
24630
  }
24625
24631
  /** @internal */
24626
24632
  build(table5) {
24627
- return new PgVector(table5, this.config);
24633
+ return new PgVector(
24634
+ table5,
24635
+ this.config
24636
+ );
24628
24637
  }
24629
24638
  };
24630
24639
  __publicField(PgVectorBuilder, _a113, "PgVectorBuilder");
@@ -24756,7 +24765,7 @@ function pgTableWithSchema(name2, columns, extraConfig, schema5, baseName = name
24756
24765
  }
24757
24766
  });
24758
24767
  }
24759
- var InlineForeignKeys, EnableRLS, _a115, _b94, _c2, _d2, _e2, PgTable, pgTable;
24768
+ var InlineForeignKeys, EnableRLS, _a115, _b94, _c3, _d2, _e2, PgTable, pgTable;
24760
24769
  var init_table2 = __esm({
24761
24770
  "../drizzle-orm/dist/pg-core/table.js"() {
24762
24771
  "use strict";
@@ -24765,11 +24774,11 @@ var init_table2 = __esm({
24765
24774
  init_all();
24766
24775
  InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
24767
24776
  EnableRLS = Symbol.for("drizzle:EnableRLS");
24768
- PgTable = class extends (_e2 = Table2, _d2 = entityKind, _c2 = InlineForeignKeys, _b94 = EnableRLS, _a115 = Table2.Symbol.ExtraConfigBuilder, _e2) {
24777
+ PgTable = class extends (_e2 = Table2, _d2 = entityKind, _c3 = InlineForeignKeys, _b94 = EnableRLS, _a115 = Table2.Symbol.ExtraConfigBuilder, _e2) {
24769
24778
  constructor() {
24770
24779
  super(...arguments);
24771
24780
  /**@internal */
24772
- __publicField(this, _c2, []);
24781
+ __publicField(this, _c3, []);
24773
24782
  /** @internal */
24774
24783
  __publicField(this, _b94, false);
24775
24784
  /** @internal */
@@ -25284,6 +25293,7 @@ __export(dist_exports, {
25284
25293
  getTableLikeName: () => getTableLikeName,
25285
25294
  getTableName: () => getTableName,
25286
25295
  getTableUniqueName: () => getTableUniqueName,
25296
+ getViewSelectedFields: () => getViewSelectedFields,
25287
25297
  gt: () => gt,
25288
25298
  gte: () => gte,
25289
25299
  hammingDistance: () => hammingDistance,
@@ -25299,6 +25309,7 @@ __export(dist_exports, {
25299
25309
  isNull: () => isNull,
25300
25310
  isSQLWrapper: () => isSQLWrapper,
25301
25311
  isTable: () => isTable,
25312
+ isView: () => isView,
25302
25313
  jaccardDistance: () => jaccardDistance,
25303
25314
  l1Distance: () => l1Distance,
25304
25315
  l2Distance: () => l2Distance,
@@ -28148,13 +28159,13 @@ var init_query_builders = __esm({
28148
28159
  });
28149
28160
 
28150
28161
  // ../drizzle-orm/dist/pg-core/query-builders/count.js
28151
- var _a139, _b104, _c3, _PgCountBuilder, PgCountBuilder;
28162
+ var _a139, _b104, _c4, _PgCountBuilder, PgCountBuilder;
28152
28163
  var init_count = __esm({
28153
28164
  "../drizzle-orm/dist/pg-core/query-builders/count.js"() {
28154
28165
  "use strict";
28155
28166
  init_entity();
28156
28167
  init_sql();
28157
- _PgCountBuilder = class _PgCountBuilder extends (_c3 = SQL, _b104 = entityKind, _a139 = Symbol.toStringTag, _c3) {
28168
+ _PgCountBuilder = class _PgCountBuilder extends (_c4 = SQL, _b104 = entityKind, _a139 = Symbol.toStringTag, _c4) {
28158
28169
  constructor(params) {
28159
28170
  super(_PgCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
28160
28171
  __publicField(this, "sql");
@@ -28893,7 +28904,7 @@ function isPgView(obj) {
28893
28904
  function isPgMaterializedView(obj) {
28894
28905
  return is(obj, PgMaterializedView);
28895
28906
  }
28896
- 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;
28907
+ 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;
28897
28908
  var init_view = __esm({
28898
28909
  "../drizzle-orm/dist/pg-core/view.js"() {
28899
28910
  "use strict";
@@ -29103,7 +29114,7 @@ var init_view = __esm({
29103
29114
  }
29104
29115
  };
29105
29116
  __publicField(ManualMaterializedViewBuilder, _a155, "PgManualMaterializedViewBuilder");
29106
- PgView2 = class extends (_c4 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c4) {
29117
+ PgView2 = class extends (_c5 = PgViewBase, _b111 = entityKind, _a156 = PgViewConfig, _c5) {
29107
29118
  constructor({ pgConfig, config }) {
29108
29119
  super(config);
29109
29120
  __publicField(this, _a156);
@@ -29116,7 +29127,7 @@ var init_view = __esm({
29116
29127
  };
29117
29128
  __publicField(PgView2, _b111, "PgView");
29118
29129
  PgMaterializedViewConfig = Symbol.for("drizzle:PgMaterializedViewConfig");
29119
- PgMaterializedView = class extends (_c5 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c5) {
29130
+ PgMaterializedView = class extends (_c6 = PgViewBase, _b112 = entityKind, _a157 = PgMaterializedViewConfig, _c6) {
29120
29131
  constructor({ pgConfig, config }) {
29121
29132
  super(config);
29122
29133
  __publicField(this, _a157);
@@ -31664,7 +31675,10 @@ var init_text2 = __esm({
31664
31675
  }
31665
31676
  /** @internal */
31666
31677
  build(table5) {
31667
- return new SQLiteText(table5, this.config);
31678
+ return new SQLiteText(
31679
+ table5,
31680
+ this.config
31681
+ );
31668
31682
  }
31669
31683
  };
31670
31684
  __publicField(SQLiteTextBuilder, _a191, "SQLiteTextBuilder");
@@ -31765,7 +31779,7 @@ function sqliteTableBase(name2, columns, extraConfig, schema5, baseName = name2)
31765
31779
  }
31766
31780
  return table5;
31767
31781
  }
31768
- var InlineForeignKeys2, _a195, _b140, _c6, _d3, _e3, SQLiteTable, sqliteTable;
31782
+ var InlineForeignKeys2, _a195, _b140, _c7, _d3, _e3, SQLiteTable, sqliteTable;
31769
31783
  var init_table3 = __esm({
31770
31784
  "../drizzle-orm/dist/sqlite-core/table.js"() {
31771
31785
  "use strict";
@@ -31773,11 +31787,11 @@ var init_table3 = __esm({
31773
31787
  init_table();
31774
31788
  init_all2();
31775
31789
  InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
31776
- SQLiteTable = class extends (_e3 = Table2, _d3 = entityKind, _c6 = Table2.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table2.Symbol.ExtraConfigBuilder, _e3) {
31790
+ SQLiteTable = class extends (_e3 = Table2, _d3 = entityKind, _c7 = Table2.Symbol.Columns, _b140 = InlineForeignKeys2, _a195 = Table2.Symbol.ExtraConfigBuilder, _e3) {
31777
31791
  constructor() {
31778
31792
  super(...arguments);
31779
31793
  /** @internal */
31780
- __publicField(this, _c6);
31794
+ __publicField(this, _c7);
31781
31795
  /** @internal */
31782
31796
  __publicField(this, _b140, []);
31783
31797
  /** @internal */
@@ -33645,13 +33659,13 @@ var init_query_builders2 = __esm({
33645
33659
  });
33646
33660
 
33647
33661
  // ../drizzle-orm/dist/sqlite-core/query-builders/count.js
33648
- var _a209, _b149, _c7, _SQLiteCountBuilder, SQLiteCountBuilder;
33662
+ var _a209, _b149, _c8, _SQLiteCountBuilder, SQLiteCountBuilder;
33649
33663
  var init_count2 = __esm({
33650
33664
  "../drizzle-orm/dist/sqlite-core/query-builders/count.js"() {
33651
33665
  "use strict";
33652
33666
  init_entity();
33653
33667
  init_sql();
33654
- _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c7 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c7) {
33668
+ _SQLiteCountBuilder = class _SQLiteCountBuilder extends (_c8 = SQL, _b149 = entityKind, _a209 = Symbol.toStringTag, _c8) {
33655
33669
  constructor(params) {
33656
33670
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
33657
33671
  __publicField(this, "sql");
@@ -34423,7 +34437,8 @@ function getTableConfig2(table5) {
34423
34437
  const extraConfigBuilder = table5[SQLiteTable.Symbol.ExtraConfigBuilder];
34424
34438
  if (extraConfigBuilder !== void 0) {
34425
34439
  const extraConfig = extraConfigBuilder(table5[SQLiteTable.Symbol.Columns]);
34426
- for (const builder of Object.values(extraConfig)) {
34440
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
34441
+ for (const builder of Object.values(extraValues)) {
34427
34442
  if (is(builder, IndexBuilder2)) {
34428
34443
  indexes.push(builder.build(table5));
34429
34444
  } else if (is(builder, CheckBuilder2)) {
@@ -36320,6 +36335,18 @@ function text3(a, b = {}) {
36320
36335
  const { name: name2, config } = getColumnNameAndConfig(a, b);
36321
36336
  return new MySqlTextBuilder(name2, "text", config);
36322
36337
  }
36338
+ function tinytext(a, b = {}) {
36339
+ const { name: name2, config } = getColumnNameAndConfig(a, b);
36340
+ return new MySqlTextBuilder(name2, "tinytext", config);
36341
+ }
36342
+ function mediumtext(a, b = {}) {
36343
+ const { name: name2, config } = getColumnNameAndConfig(a, b);
36344
+ return new MySqlTextBuilder(name2, "mediumtext", config);
36345
+ }
36346
+ function longtext(a, b = {}) {
36347
+ const { name: name2, config } = getColumnNameAndConfig(a, b);
36348
+ return new MySqlTextBuilder(name2, "longtext", config);
36349
+ }
36323
36350
  var _a279, _b202, MySqlTextBuilder, _a280, _b203, MySqlText;
36324
36351
  var init_text3 = __esm({
36325
36352
  "../drizzle-orm/dist/mysql-core/columns/text.js"() {
@@ -36679,13 +36706,13 @@ var init_columns3 = __esm({
36679
36706
  });
36680
36707
 
36681
36708
  // ../drizzle-orm/dist/mysql-core/query-builders/count.js
36682
- var _a297, _b220, _c8, _MySqlCountBuilder, MySqlCountBuilder;
36709
+ var _a297, _b220, _c9, _MySqlCountBuilder, MySqlCountBuilder;
36683
36710
  var init_count3 = __esm({
36684
36711
  "../drizzle-orm/dist/mysql-core/query-builders/count.js"() {
36685
36712
  "use strict";
36686
36713
  init_entity();
36687
36714
  init_sql();
36688
- _MySqlCountBuilder = class _MySqlCountBuilder extends (_c8 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c8) {
36715
+ _MySqlCountBuilder = class _MySqlCountBuilder extends (_c9 = SQL, _b220 = entityKind, _a297 = Symbol.toStringTag, _c9) {
36689
36716
  constructor(params) {
36690
36717
  super(_MySqlCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
36691
36718
  __publicField(this, "sql");
@@ -36861,7 +36888,10 @@ function getMySqlColumnBuilders() {
36861
36888
  tinyint,
36862
36889
  varbinary,
36863
36890
  varchar: varchar2,
36864
- year
36891
+ year,
36892
+ longtext,
36893
+ mediumtext,
36894
+ tinytext
36865
36895
  };
36866
36896
  }
36867
36897
  var init_all3 = __esm({
@@ -36915,7 +36945,7 @@ function mysqlTableWithSchema(name2, columns, extraConfig, schema5, baseName = n
36915
36945
  }
36916
36946
  return table5;
36917
36947
  }
36918
- var InlineForeignKeys3, _a299, _b222, _c9, _d4, _e4, MySqlTable, mysqlTable;
36948
+ var InlineForeignKeys3, _a299, _b222, _c10, _d4, _e4, MySqlTable, mysqlTable;
36919
36949
  var init_table4 = __esm({
36920
36950
  "../drizzle-orm/dist/mysql-core/table.js"() {
36921
36951
  "use strict";
@@ -36923,11 +36953,11 @@ var init_table4 = __esm({
36923
36953
  init_table();
36924
36954
  init_all3();
36925
36955
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
36926
- MySqlTable = class extends (_e4 = Table2, _d4 = entityKind, _c9 = Table2.Symbol.Columns, _b222 = InlineForeignKeys3, _a299 = Table2.Symbol.ExtraConfigBuilder, _e4) {
36956
+ MySqlTable = class extends (_e4 = Table2, _d4 = entityKind, _c10 = Table2.Symbol.Columns, _b222 = InlineForeignKeys3, _a299 = Table2.Symbol.ExtraConfigBuilder, _e4) {
36927
36957
  constructor() {
36928
36958
  super(...arguments);
36929
36959
  /** @internal */
36930
- __publicField(this, _c9);
36960
+ __publicField(this, _c10);
36931
36961
  /** @internal */
36932
36962
  __publicField(this, _b222, []);
36933
36963
  /** @internal */
@@ -37123,6 +37153,12 @@ var init_dialect3 = __esm({
37123
37153
  buildOrderBy(orderBy) {
37124
37154
  return orderBy && orderBy.length > 0 ? sql` order by ${sql.join(orderBy, sql`, `)}` : void 0;
37125
37155
  }
37156
+ buildIndex({
37157
+ indexes,
37158
+ indexFor
37159
+ }) {
37160
+ return indexes && indexes.length > 0 ? sql` ${sql.raw(indexFor)} INDEX (${sql.raw(indexes.join(`, `))})` : void 0;
37161
+ }
37126
37162
  buildSelectQuery({
37127
37163
  withList,
37128
37164
  fields,
@@ -37137,7 +37173,10 @@ var init_dialect3 = __esm({
37137
37173
  offset,
37138
37174
  lockingClause,
37139
37175
  distinct,
37140
- setOperators
37176
+ setOperators,
37177
+ useIndex,
37178
+ forceIndex,
37179
+ ignoreIndex
37141
37180
  }) {
37142
37181
  const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
37143
37182
  for (const f of fieldsList) {
@@ -37173,8 +37212,11 @@ var init_dialect3 = __esm({
37173
37212
  const tableSchema = table22[MySqlTable.Symbol.Schema];
37174
37213
  const origTableName = table22[MySqlTable.Symbol.OriginalName];
37175
37214
  const alias = tableName === origTableName ? void 0 : joinMeta.alias;
37215
+ const useIndexSql2 = this.buildIndex({ indexes: joinMeta.useIndex, indexFor: "USE" });
37216
+ const forceIndexSql2 = this.buildIndex({ indexes: joinMeta.forceIndex, indexFor: "FORCE" });
37217
+ const ignoreIndexSql2 = this.buildIndex({ indexes: joinMeta.ignoreIndex, indexFor: "IGNORE" });
37176
37218
  joinsArray.push(
37177
- 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}`
37219
+ 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}`
37178
37220
  );
37179
37221
  } else if (is(table22, View3)) {
37180
37222
  const viewName = table22[ViewBaseConfig].name;
@@ -37201,6 +37243,9 @@ var init_dialect3 = __esm({
37201
37243
  const groupBySql = groupBy && groupBy.length > 0 ? sql` group by ${sql.join(groupBy, sql`, `)}` : void 0;
37202
37244
  const limitSql = this.buildLimit(limit);
37203
37245
  const offsetSql = offset ? sql` offset ${offset}` : void 0;
37246
+ const useIndexSql = this.buildIndex({ indexes: useIndex, indexFor: "USE" });
37247
+ const forceIndexSql = this.buildIndex({ indexes: forceIndex, indexFor: "FORCE" });
37248
+ const ignoreIndexSql = this.buildIndex({ indexes: ignoreIndex, indexFor: "IGNORE" });
37204
37249
  let lockingClausesSql;
37205
37250
  if (lockingClause) {
37206
37251
  const { config, strength } = lockingClause;
@@ -37211,7 +37256,7 @@ var init_dialect3 = __esm({
37211
37256
  lockingClausesSql.append(sql` skip locked`);
37212
37257
  }
37213
37258
  }
37214
- const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClausesSql}`;
37259
+ const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${useIndexSql}${forceIndexSql}${ignoreIndexSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClausesSql}`;
37215
37260
  if (setOperators.length > 0) {
37216
37261
  return this.buildSetOperations(finalQuery, setOperators);
37217
37262
  }
@@ -37779,6 +37824,183 @@ var init_dialect3 = __esm({
37779
37824
  }
37780
37825
  });
37781
37826
 
37827
+ // ../drizzle-orm/dist/mysql-core/indexes.js
37828
+ var _a302, IndexBuilderOn3, _a303, IndexBuilder3, _a304, Index5;
37829
+ var init_indexes3 = __esm({
37830
+ "../drizzle-orm/dist/mysql-core/indexes.js"() {
37831
+ "use strict";
37832
+ init_entity();
37833
+ _a302 = entityKind;
37834
+ IndexBuilderOn3 = class {
37835
+ constructor(name2, unique) {
37836
+ this.name = name2;
37837
+ this.unique = unique;
37838
+ }
37839
+ on(...columns) {
37840
+ return new IndexBuilder3(this.name, columns, this.unique);
37841
+ }
37842
+ };
37843
+ __publicField(IndexBuilderOn3, _a302, "MySqlIndexBuilderOn");
37844
+ _a303 = entityKind;
37845
+ IndexBuilder3 = class {
37846
+ constructor(name2, columns, unique) {
37847
+ /** @internal */
37848
+ __publicField(this, "config");
37849
+ this.config = {
37850
+ name: name2,
37851
+ columns,
37852
+ unique
37853
+ };
37854
+ }
37855
+ using(using) {
37856
+ this.config.using = using;
37857
+ return this;
37858
+ }
37859
+ algorythm(algorythm) {
37860
+ this.config.algorythm = algorythm;
37861
+ return this;
37862
+ }
37863
+ lock(lock) {
37864
+ this.config.lock = lock;
37865
+ return this;
37866
+ }
37867
+ /** @internal */
37868
+ build(table5) {
37869
+ return new Index5(this.config, table5);
37870
+ }
37871
+ };
37872
+ __publicField(IndexBuilder3, _a303, "MySqlIndexBuilder");
37873
+ _a304 = entityKind;
37874
+ Index5 = class {
37875
+ constructor(config, table5) {
37876
+ __publicField(this, "config");
37877
+ this.config = { ...config, table: table5 };
37878
+ }
37879
+ };
37880
+ __publicField(Index5, _a304, "MySqlIndex");
37881
+ }
37882
+ });
37883
+
37884
+ // ../drizzle-orm/dist/mysql-core/primary-keys.js
37885
+ var _a305, PrimaryKeyBuilder3, _a306, PrimaryKey3;
37886
+ var init_primary_keys3 = __esm({
37887
+ "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
37888
+ "use strict";
37889
+ init_entity();
37890
+ init_table4();
37891
+ _a305 = entityKind;
37892
+ PrimaryKeyBuilder3 = class {
37893
+ constructor(columns, name2) {
37894
+ /** @internal */
37895
+ __publicField(this, "columns");
37896
+ /** @internal */
37897
+ __publicField(this, "name");
37898
+ this.columns = columns;
37899
+ this.name = name2;
37900
+ }
37901
+ /** @internal */
37902
+ build(table5) {
37903
+ return new PrimaryKey3(table5, this.columns, this.name);
37904
+ }
37905
+ };
37906
+ __publicField(PrimaryKeyBuilder3, _a305, "MySqlPrimaryKeyBuilder");
37907
+ _a306 = entityKind;
37908
+ PrimaryKey3 = class {
37909
+ constructor(table5, columns, name2) {
37910
+ __publicField(this, "columns");
37911
+ __publicField(this, "name");
37912
+ this.table = table5;
37913
+ this.columns = columns;
37914
+ this.name = name2;
37915
+ }
37916
+ getName() {
37917
+ return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column5) => column5.name).join("_")}_pk`;
37918
+ }
37919
+ };
37920
+ __publicField(PrimaryKey3, _a306, "MySqlPrimaryKey");
37921
+ }
37922
+ });
37923
+
37924
+ // ../drizzle-orm/dist/mysql-core/view-common.js
37925
+ var MySqlViewConfig;
37926
+ var init_view_common3 = __esm({
37927
+ "../drizzle-orm/dist/mysql-core/view-common.js"() {
37928
+ "use strict";
37929
+ MySqlViewConfig = Symbol.for("drizzle:MySqlViewConfig");
37930
+ }
37931
+ });
37932
+
37933
+ // ../drizzle-orm/dist/mysql-core/utils.js
37934
+ function getTableConfig3(table5) {
37935
+ const columns = Object.values(table5[MySqlTable.Symbol.Columns]);
37936
+ const indexes = [];
37937
+ const checks = [];
37938
+ const primaryKeys = [];
37939
+ const uniqueConstraints = [];
37940
+ const foreignKeys = Object.values(table5[MySqlTable.Symbol.InlineForeignKeys]);
37941
+ const name2 = table5[Table2.Symbol.Name];
37942
+ const schema5 = table5[Table2.Symbol.Schema];
37943
+ const baseName = table5[Table2.Symbol.BaseName];
37944
+ const extraConfigBuilder = table5[MySqlTable.Symbol.ExtraConfigBuilder];
37945
+ if (extraConfigBuilder !== void 0) {
37946
+ const extraConfig = extraConfigBuilder(table5[MySqlTable.Symbol.Columns]);
37947
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
37948
+ for (const builder of Object.values(extraValues)) {
37949
+ if (is(builder, IndexBuilder3)) {
37950
+ indexes.push(builder.build(table5));
37951
+ } else if (is(builder, CheckBuilder3)) {
37952
+ checks.push(builder.build(table5));
37953
+ } else if (is(builder, UniqueConstraintBuilder3)) {
37954
+ uniqueConstraints.push(builder.build(table5));
37955
+ } else if (is(builder, PrimaryKeyBuilder3)) {
37956
+ primaryKeys.push(builder.build(table5));
37957
+ } else if (is(builder, ForeignKeyBuilder3)) {
37958
+ foreignKeys.push(builder.build(table5));
37959
+ }
37960
+ }
37961
+ }
37962
+ return {
37963
+ columns,
37964
+ indexes,
37965
+ foreignKeys,
37966
+ checks,
37967
+ primaryKeys,
37968
+ uniqueConstraints,
37969
+ name: name2,
37970
+ schema: schema5,
37971
+ baseName
37972
+ };
37973
+ }
37974
+ function getViewConfig3(view4) {
37975
+ return {
37976
+ ...view4[ViewBaseConfig],
37977
+ ...view4[MySqlViewConfig]
37978
+ };
37979
+ }
37980
+ function convertIndexToString(indexes) {
37981
+ return indexes.map((idx) => {
37982
+ return typeof idx === "object" ? idx.config.name : idx;
37983
+ });
37984
+ }
37985
+ function toArray(value) {
37986
+ return Array.isArray(value) ? value : [value];
37987
+ }
37988
+ var init_utils8 = __esm({
37989
+ "../drizzle-orm/dist/mysql-core/utils.js"() {
37990
+ "use strict";
37991
+ init_entity();
37992
+ init_table();
37993
+ init_view_common();
37994
+ init_checks3();
37995
+ init_foreign_keys3();
37996
+ init_indexes3();
37997
+ init_primary_keys3();
37998
+ init_table4();
37999
+ init_unique_constraint3();
38000
+ init_view_common3();
38001
+ }
38002
+ });
38003
+
37782
38004
  // ../drizzle-orm/dist/mysql-core/query-builders/select.js
37783
38005
  function createSetOperator3(type, isAll) {
37784
38006
  return (leftSelect, rightSelect, ...restSelects) => {
@@ -37797,11 +38019,12 @@ function createSetOperator3(type, isAll) {
37797
38019
  return leftSelect.addSetOperators(setOperators);
37798
38020
  };
37799
38021
  }
37800
- var _a302, MySqlSelectBuilder, _a303, _b224, MySqlSelectQueryBuilderBase, _a304, _b225, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
38022
+ var _a307, MySqlSelectBuilder, _a308, _b224, MySqlSelectQueryBuilderBase, _a309, _b225, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
37801
38023
  var init_select4 = __esm({
37802
38024
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
37803
38025
  "use strict";
37804
38026
  init_entity();
38027
+ init_table4();
37805
38028
  init_query_builder();
37806
38029
  init_query_promise();
37807
38030
  init_selection_proxy();
@@ -37809,10 +38032,10 @@ var init_select4 = __esm({
37809
38032
  init_subquery();
37810
38033
  init_table();
37811
38034
  init_utils2();
37812
- init_utils2();
37813
38035
  init_view_common();
38036
+ init_utils8();
37814
38037
  init_view_base3();
37815
- _a302 = entityKind;
38038
+ _a307 = entityKind;
37816
38039
  MySqlSelectBuilder = class {
37817
38040
  constructor(config) {
37818
38041
  __publicField(this, "fields");
@@ -37828,7 +38051,7 @@ var init_select4 = __esm({
37828
38051
  }
37829
38052
  this.distinct = config.distinct;
37830
38053
  }
37831
- from(source) {
38054
+ from(source, onIndex) {
37832
38055
  const isPartialSelect = !!this.fields;
37833
38056
  let fields;
37834
38057
  if (this.fields) {
@@ -37844,6 +38067,20 @@ var init_select4 = __esm({
37844
38067
  } else {
37845
38068
  fields = getTableColumns(source);
37846
38069
  }
38070
+ let useIndex = [];
38071
+ let forceIndex = [];
38072
+ let ignoreIndex = [];
38073
+ if (is(source, MySqlTable) && onIndex && typeof onIndex !== "string") {
38074
+ if (onIndex.useIndex) {
38075
+ useIndex = convertIndexToString(toArray(onIndex.useIndex));
38076
+ }
38077
+ if (onIndex.forceIndex) {
38078
+ forceIndex = convertIndexToString(toArray(onIndex.forceIndex));
38079
+ }
38080
+ if (onIndex.ignoreIndex) {
38081
+ ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex));
38082
+ }
38083
+ }
37847
38084
  return new MySqlSelectBase(
37848
38085
  {
37849
38086
  table: source,
@@ -37852,14 +38089,17 @@ var init_select4 = __esm({
37852
38089
  session: this.session,
37853
38090
  dialect: this.dialect,
37854
38091
  withList: this.withList,
37855
- distinct: this.distinct
38092
+ distinct: this.distinct,
38093
+ useIndex,
38094
+ forceIndex,
38095
+ ignoreIndex
37856
38096
  }
37857
38097
  );
37858
38098
  }
37859
38099
  };
37860
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
37861
- MySqlSelectQueryBuilderBase = class extends (_b224 = TypedQueryBuilder, _a303 = entityKind, _b224) {
37862
- constructor({ table: table5, fields, isPartialSelect, session, dialect: dialect6, withList, distinct }) {
38100
+ __publicField(MySqlSelectBuilder, _a307, "MySqlSelectBuilder");
38101
+ MySqlSelectQueryBuilderBase = class extends (_b224 = TypedQueryBuilder, _a308 = entityKind, _b224) {
38102
+ constructor({ table: table5, fields, isPartialSelect, session, dialect: dialect6, withList, distinct, useIndex, forceIndex, ignoreIndex }) {
37863
38103
  super();
37864
38104
  __publicField(this, "_");
37865
38105
  __publicField(this, "config");
@@ -37894,6 +38134,16 @@ var init_select4 = __esm({
37894
38134
  * })
37895
38135
  * .from(users)
37896
38136
  * .leftJoin(pets, eq(users.id, pets.ownerId))
38137
+ *
38138
+ * // Select userId and petId with use index hint
38139
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38140
+ * userId: users.id,
38141
+ * petId: pets.id,
38142
+ * })
38143
+ * .from(users)
38144
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38145
+ * useIndex: ['pets_owner_id_index']
38146
+ * })
37897
38147
  * ```
37898
38148
  */
37899
38149
  __publicField(this, "leftJoin", this.createJoin("left"));
@@ -37922,6 +38172,16 @@ var init_select4 = __esm({
37922
38172
  * })
37923
38173
  * .from(users)
37924
38174
  * .rightJoin(pets, eq(users.id, pets.ownerId))
38175
+ *
38176
+ * // Select userId and petId with use index hint
38177
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38178
+ * userId: users.id,
38179
+ * petId: pets.id,
38180
+ * })
38181
+ * .from(users)
38182
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38183
+ * useIndex: ['pets_owner_id_index']
38184
+ * })
37925
38185
  * ```
37926
38186
  */
37927
38187
  __publicField(this, "rightJoin", this.createJoin("right"));
@@ -37950,6 +38210,16 @@ var init_select4 = __esm({
37950
38210
  * })
37951
38211
  * .from(users)
37952
38212
  * .innerJoin(pets, eq(users.id, pets.ownerId))
38213
+ *
38214
+ * // Select userId and petId with use index hint
38215
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38216
+ * userId: users.id,
38217
+ * petId: pets.id,
38218
+ * })
38219
+ * .from(users)
38220
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38221
+ * useIndex: ['pets_owner_id_index']
38222
+ * })
37953
38223
  * ```
37954
38224
  */
37955
38225
  __publicField(this, "innerJoin", this.createJoin("inner"));
@@ -37978,6 +38248,16 @@ var init_select4 = __esm({
37978
38248
  * })
37979
38249
  * .from(users)
37980
38250
  * .fullJoin(pets, eq(users.id, pets.ownerId))
38251
+ *
38252
+ * // Select userId and petId with use index hint
38253
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38254
+ * userId: users.id,
38255
+ * petId: pets.id,
38256
+ * })
38257
+ * .from(users)
38258
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38259
+ * useIndex: ['pets_owner_id_index']
38260
+ * })
37981
38261
  * ```
37982
38262
  */
37983
38263
  __publicField(this, "fullJoin", this.createJoin("full"));
@@ -38172,7 +38452,10 @@ var init_select4 = __esm({
38172
38452
  table: table5,
38173
38453
  fields: { ...fields },
38174
38454
  distinct,
38175
- setOperators: []
38455
+ setOperators: [],
38456
+ useIndex,
38457
+ forceIndex,
38458
+ ignoreIndex
38176
38459
  };
38177
38460
  this.isPartialSelect = isPartialSelect;
38178
38461
  this.session = session;
@@ -38184,7 +38467,7 @@ var init_select4 = __esm({
38184
38467
  this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
38185
38468
  }
38186
38469
  createJoin(joinType) {
38187
- return (table5, on) => {
38470
+ return (table5, on, onIndex) => {
38188
38471
  const baseTableName = this.tableName;
38189
38472
  const tableName = getTableLikeName(table5);
38190
38473
  if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
@@ -38212,7 +38495,21 @@ var init_select4 = __esm({
38212
38495
  if (!this.config.joins) {
38213
38496
  this.config.joins = [];
38214
38497
  }
38215
- this.config.joins.push({ on, table: table5, joinType, alias: tableName });
38498
+ let useIndex = [];
38499
+ let forceIndex = [];
38500
+ let ignoreIndex = [];
38501
+ if (is(table5, MySqlTable) && onIndex && typeof onIndex !== "string") {
38502
+ if (onIndex.useIndex) {
38503
+ useIndex = convertIndexToString(toArray(onIndex.useIndex));
38504
+ }
38505
+ if (onIndex.forceIndex) {
38506
+ forceIndex = convertIndexToString(toArray(onIndex.forceIndex));
38507
+ }
38508
+ if (onIndex.ignoreIndex) {
38509
+ ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex));
38510
+ }
38511
+ }
38512
+ this.config.joins.push({ on, table: table5, joinType, alias: tableName, useIndex, forceIndex, ignoreIndex });
38216
38513
  if (typeof tableName === "string") {
38217
38514
  switch (joinType) {
38218
38515
  case "left": {
@@ -38459,8 +38756,8 @@ var init_select4 = __esm({
38459
38756
  return this;
38460
38757
  }
38461
38758
  };
38462
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
38463
- MySqlSelectBase = class extends (_b225 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b225) {
38759
+ __publicField(MySqlSelectQueryBuilderBase, _a308, "MySqlSelectQueryBuilder");
38760
+ MySqlSelectBase = class extends (_b225 = MySqlSelectQueryBuilderBase, _a309 = entityKind, _b225) {
38464
38761
  constructor() {
38465
38762
  super(...arguments);
38466
38763
  __publicField(this, "execute", (placeholderValues) => {
@@ -38484,7 +38781,7 @@ var init_select4 = __esm({
38484
38781
  return query;
38485
38782
  }
38486
38783
  };
38487
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
38784
+ __publicField(MySqlSelectBase, _a309, "MySqlSelect");
38488
38785
  applyMixins(MySqlSelectBase, [QueryPromise]);
38489
38786
  getMySqlSetOperators = () => ({
38490
38787
  union: union3,
@@ -38504,7 +38801,7 @@ var init_select4 = __esm({
38504
38801
  });
38505
38802
 
38506
38803
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
38507
- var _a305, QueryBuilder3;
38804
+ var _a310, QueryBuilder3;
38508
38805
  var init_query_builder4 = __esm({
38509
38806
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
38510
38807
  "use strict";
@@ -38513,7 +38810,7 @@ var init_query_builder4 = __esm({
38513
38810
  init_selection_proxy();
38514
38811
  init_subquery();
38515
38812
  init_select4();
38516
- _a305 = entityKind;
38813
+ _a310 = entityKind;
38517
38814
  QueryBuilder3 = class {
38518
38815
  constructor(dialect6) {
38519
38816
  __publicField(this, "dialect");
@@ -38575,12 +38872,12 @@ var init_query_builder4 = __esm({
38575
38872
  return this.dialect;
38576
38873
  }
38577
38874
  };
38578
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
38875
+ __publicField(QueryBuilder3, _a310, "MySqlQueryBuilder");
38579
38876
  }
38580
38877
  });
38581
38878
 
38582
38879
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
38583
- var _a306, MySqlInsertBuilder, _a307, _b226, MySqlInsertBase;
38880
+ var _a311, MySqlInsertBuilder, _a312, _b226, MySqlInsertBase;
38584
38881
  var init_insert3 = __esm({
38585
38882
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
38586
38883
  "use strict";
@@ -38590,7 +38887,7 @@ var init_insert3 = __esm({
38590
38887
  init_table();
38591
38888
  init_utils2();
38592
38889
  init_query_builder4();
38593
- _a306 = entityKind;
38890
+ _a311 = entityKind;
38594
38891
  MySqlInsertBuilder = class {
38595
38892
  constructor(table5, session, dialect6) {
38596
38893
  __publicField(this, "shouldIgnore", false);
@@ -38628,8 +38925,8 @@ var init_insert3 = __esm({
38628
38925
  return new MySqlInsertBase(this.table, select, this.shouldIgnore, this.session, this.dialect, true);
38629
38926
  }
38630
38927
  };
38631
- __publicField(MySqlInsertBuilder, _a306, "MySqlInsertBuilder");
38632
- MySqlInsertBase = class extends (_b226 = QueryPromise, _a307 = entityKind, _b226) {
38928
+ __publicField(MySqlInsertBuilder, _a311, "MySqlInsertBuilder");
38929
+ MySqlInsertBase = class extends (_b226 = QueryPromise, _a312 = entityKind, _b226) {
38633
38930
  constructor(table5, values, ignore, session, dialect6, select) {
38634
38931
  super();
38635
38932
  __publicField(this, "config");
@@ -38710,7 +39007,7 @@ var init_insert3 = __esm({
38710
39007
  return this;
38711
39008
  }
38712
39009
  };
38713
- __publicField(MySqlInsertBase, _a307, "MySqlInsert");
39010
+ __publicField(MySqlInsertBase, _a312, "MySqlInsert");
38714
39011
  }
38715
39012
  });
38716
39013
 
@@ -38722,7 +39019,7 @@ var init_select_types3 = __esm({
38722
39019
  });
38723
39020
 
38724
39021
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
38725
- var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
39022
+ var _a313, MySqlUpdateBuilder, _a314, _b227, MySqlUpdateBase;
38726
39023
  var init_update3 = __esm({
38727
39024
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
38728
39025
  "use strict";
@@ -38731,7 +39028,7 @@ var init_update3 = __esm({
38731
39028
  init_selection_proxy();
38732
39029
  init_table();
38733
39030
  init_utils2();
38734
- _a308 = entityKind;
39031
+ _a313 = entityKind;
38735
39032
  MySqlUpdateBuilder = class {
38736
39033
  constructor(table5, session, dialect6, withList) {
38737
39034
  this.table = table5;
@@ -38743,8 +39040,8 @@ var init_update3 = __esm({
38743
39040
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
38744
39041
  }
38745
39042
  };
38746
- __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
38747
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
39043
+ __publicField(MySqlUpdateBuilder, _a313, "MySqlUpdateBuilder");
39044
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a314 = entityKind, _b227) {
38748
39045
  constructor(table5, set, session, dialect6, withList) {
38749
39046
  super();
38750
39047
  __publicField(this, "config");
@@ -38837,7 +39134,7 @@ var init_update3 = __esm({
38837
39134
  return this;
38838
39135
  }
38839
39136
  };
38840
- __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
39137
+ __publicField(MySqlUpdateBase, _a314, "MySqlUpdate");
38841
39138
  }
38842
39139
  });
38843
39140
 
@@ -38855,14 +39152,14 @@ var init_query_builders3 = __esm({
38855
39152
  });
38856
39153
 
38857
39154
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
38858
- var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
39155
+ var _a315, RelationalQueryBuilder3, _a316, _b228, MySqlRelationalQuery;
38859
39156
  var init_query3 = __esm({
38860
39157
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
38861
39158
  "use strict";
38862
39159
  init_entity();
38863
39160
  init_query_promise();
38864
39161
  init_relations();
38865
- _a310 = entityKind;
39162
+ _a315 = entityKind;
38866
39163
  RelationalQueryBuilder3 = class {
38867
39164
  constructor(fullSchema, schema5, tableNamesMap, table5, tableConfig, dialect6, session, mode) {
38868
39165
  this.fullSchema = fullSchema;
@@ -38903,8 +39200,8 @@ var init_query3 = __esm({
38903
39200
  );
38904
39201
  }
38905
39202
  };
38906
- __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
38907
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
39203
+ __publicField(RelationalQueryBuilder3, _a315, "MySqlRelationalQueryBuilder");
39204
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a316 = entityKind, _b228) {
38908
39205
  constructor(fullSchema, schema5, tableNamesMap, table5, tableConfig, dialect6, session, config, queryMode, mode) {
38909
39206
  super();
38910
39207
  this.fullSchema = fullSchema;
@@ -38968,12 +39265,12 @@ var init_query3 = __esm({
38968
39265
  return this.prepare().execute();
38969
39266
  }
38970
39267
  };
38971
- __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
39268
+ __publicField(MySqlRelationalQuery, _a316, "MySqlRelationalQuery");
38972
39269
  }
38973
39270
  });
38974
39271
 
38975
39272
  // ../drizzle-orm/dist/mysql-core/db.js
38976
- var _a312, MySqlDatabase;
39273
+ var _a317, MySqlDatabase;
38977
39274
  var init_db3 = __esm({
38978
39275
  "../drizzle-orm/dist/mysql-core/db.js"() {
38979
39276
  "use strict";
@@ -38984,7 +39281,7 @@ var init_db3 = __esm({
38984
39281
  init_count3();
38985
39282
  init_query_builders3();
38986
39283
  init_query3();
38987
- _a312 = entityKind;
39284
+ _a317 = entityKind;
38988
39285
  MySqlDatabase = class {
38989
39286
  constructor(dialect6, session, schema5, mode) {
38990
39287
  __publicField(this, "query");
@@ -39197,113 +39494,7 @@ var init_db3 = __esm({
39197
39494
  return this.session.transaction(transaction, config);
39198
39495
  }
39199
39496
  };
39200
- __publicField(MySqlDatabase, _a312, "MySqlDatabase");
39201
- }
39202
- });
39203
-
39204
- // ../drizzle-orm/dist/mysql-core/indexes.js
39205
- var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
39206
- var init_indexes3 = __esm({
39207
- "../drizzle-orm/dist/mysql-core/indexes.js"() {
39208
- "use strict";
39209
- init_entity();
39210
- _a313 = entityKind;
39211
- IndexBuilderOn3 = class {
39212
- constructor(name2, unique) {
39213
- this.name = name2;
39214
- this.unique = unique;
39215
- }
39216
- on(...columns) {
39217
- return new IndexBuilder3(this.name, columns, this.unique);
39218
- }
39219
- };
39220
- __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
39221
- _a314 = entityKind;
39222
- IndexBuilder3 = class {
39223
- constructor(name2, columns, unique) {
39224
- /** @internal */
39225
- __publicField(this, "config");
39226
- this.config = {
39227
- name: name2,
39228
- columns,
39229
- unique
39230
- };
39231
- }
39232
- using(using) {
39233
- this.config.using = using;
39234
- return this;
39235
- }
39236
- algorythm(algorythm) {
39237
- this.config.algorythm = algorythm;
39238
- return this;
39239
- }
39240
- lock(lock) {
39241
- this.config.lock = lock;
39242
- return this;
39243
- }
39244
- /** @internal */
39245
- build(table5) {
39246
- return new Index5(this.config, table5);
39247
- }
39248
- };
39249
- __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
39250
- _a315 = entityKind;
39251
- Index5 = class {
39252
- constructor(config, table5) {
39253
- __publicField(this, "config");
39254
- this.config = { ...config, table: table5 };
39255
- }
39256
- };
39257
- __publicField(Index5, _a315, "MySqlIndex");
39258
- }
39259
- });
39260
-
39261
- // ../drizzle-orm/dist/mysql-core/primary-keys.js
39262
- var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
39263
- var init_primary_keys3 = __esm({
39264
- "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
39265
- "use strict";
39266
- init_entity();
39267
- init_table4();
39268
- _a316 = entityKind;
39269
- PrimaryKeyBuilder3 = class {
39270
- constructor(columns, name2) {
39271
- /** @internal */
39272
- __publicField(this, "columns");
39273
- /** @internal */
39274
- __publicField(this, "name");
39275
- this.columns = columns;
39276
- this.name = name2;
39277
- }
39278
- /** @internal */
39279
- build(table5) {
39280
- return new PrimaryKey3(table5, this.columns, this.name);
39281
- }
39282
- };
39283
- __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
39284
- _a317 = entityKind;
39285
- PrimaryKey3 = class {
39286
- constructor(table5, columns, name2) {
39287
- __publicField(this, "columns");
39288
- __publicField(this, "name");
39289
- this.table = table5;
39290
- this.columns = columns;
39291
- this.name = name2;
39292
- }
39293
- getName() {
39294
- return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column5) => column5.name).join("_")}_pk`;
39295
- }
39296
- };
39297
- __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
39298
- }
39299
- });
39300
-
39301
- // ../drizzle-orm/dist/mysql-core/view-common.js
39302
- var MySqlViewConfig;
39303
- var init_view_common3 = __esm({
39304
- "../drizzle-orm/dist/mysql-core/view-common.js"() {
39305
- "use strict";
39306
- MySqlViewConfig = Symbol.for("drizzle:MySqlViewConfig");
39497
+ __publicField(MySqlDatabase, _a317, "MySqlDatabase");
39307
39498
  }
39308
39499
  });
39309
39500
 
@@ -39314,7 +39505,7 @@ function mysqlViewWithSchema(name2, selection, schema5) {
39314
39505
  }
39315
39506
  return new ViewBuilder3(name2, schema5);
39316
39507
  }
39317
- var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c10, MySqlView2;
39508
+ var _a318, ViewBuilderCore2, _a319, _b229, ViewBuilder3, _a320, _b230, ManualViewBuilder3, _a321, _b231, _c11, MySqlView2;
39318
39509
  var init_view3 = __esm({
39319
39510
  "../drizzle-orm/dist/mysql-core/view.js"() {
39320
39511
  "use strict";
@@ -39419,7 +39610,7 @@ var init_view3 = __esm({
39419
39610
  }
39420
39611
  };
39421
39612
  __publicField(ManualViewBuilder3, _a320, "MySqlManualViewBuilder");
39422
- MySqlView2 = class extends (_c10 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c10) {
39613
+ MySqlView2 = class extends (_c11 = MySqlViewBase, _b231 = entityKind, _a321 = MySqlViewConfig, _c11) {
39423
39614
  constructor({ mysqlConfig, config }) {
39424
39615
  super(config);
39425
39616
  __publicField(this, _a321);
@@ -39528,68 +39719,6 @@ var init_subquery4 = __esm({
39528
39719
  }
39529
39720
  });
39530
39721
 
39531
- // ../drizzle-orm/dist/mysql-core/utils.js
39532
- function getTableConfig3(table5) {
39533
- const columns = Object.values(table5[MySqlTable.Symbol.Columns]);
39534
- const indexes = [];
39535
- const checks = [];
39536
- const primaryKeys = [];
39537
- const uniqueConstraints = [];
39538
- const foreignKeys = Object.values(table5[MySqlTable.Symbol.InlineForeignKeys]);
39539
- const name2 = table5[Table2.Symbol.Name];
39540
- const schema5 = table5[Table2.Symbol.Schema];
39541
- const baseName = table5[Table2.Symbol.BaseName];
39542
- const extraConfigBuilder = table5[MySqlTable.Symbol.ExtraConfigBuilder];
39543
- if (extraConfigBuilder !== void 0) {
39544
- const extraConfig = extraConfigBuilder(table5[MySqlTable.Symbol.Columns]);
39545
- for (const builder of Object.values(extraConfig)) {
39546
- if (is(builder, IndexBuilder3)) {
39547
- indexes.push(builder.build(table5));
39548
- } else if (is(builder, CheckBuilder3)) {
39549
- checks.push(builder.build(table5));
39550
- } else if (is(builder, UniqueConstraintBuilder3)) {
39551
- uniqueConstraints.push(builder.build(table5));
39552
- } else if (is(builder, PrimaryKeyBuilder3)) {
39553
- primaryKeys.push(builder.build(table5));
39554
- } else if (is(builder, ForeignKeyBuilder3)) {
39555
- foreignKeys.push(builder.build(table5));
39556
- }
39557
- }
39558
- }
39559
- return {
39560
- columns,
39561
- indexes,
39562
- foreignKeys,
39563
- checks,
39564
- primaryKeys,
39565
- uniqueConstraints,
39566
- name: name2,
39567
- schema: schema5,
39568
- baseName
39569
- };
39570
- }
39571
- function getViewConfig3(view4) {
39572
- return {
39573
- ...view4[ViewBaseConfig],
39574
- ...view4[MySqlViewConfig]
39575
- };
39576
- }
39577
- var init_utils8 = __esm({
39578
- "../drizzle-orm/dist/mysql-core/utils.js"() {
39579
- "use strict";
39580
- init_entity();
39581
- init_table();
39582
- init_view_common();
39583
- init_checks3();
39584
- init_foreign_keys3();
39585
- init_indexes3();
39586
- init_primary_keys3();
39587
- init_table4();
39588
- init_unique_constraint3();
39589
- init_view_common3();
39590
- }
39591
- });
39592
-
39593
39722
  // ../drizzle-orm/dist/mysql-core/index.js
39594
39723
  var init_mysql_core = __esm({
39595
39724
  "../drizzle-orm/dist/mysql-core/index.js"() {
@@ -42074,13 +42203,13 @@ var init_columns4 = __esm({
42074
42203
  });
42075
42204
 
42076
42205
  // ../drizzle-orm/dist/singlestore-core/query-builders/count.js
42077
- var _a391, _b295, _c11, _SingleStoreCountBuilder, SingleStoreCountBuilder;
42206
+ var _a391, _b295, _c12, _SingleStoreCountBuilder, SingleStoreCountBuilder;
42078
42207
  var init_count4 = __esm({
42079
42208
  "../drizzle-orm/dist/singlestore-core/query-builders/count.js"() {
42080
42209
  "use strict";
42081
42210
  init_entity();
42082
42211
  init_sql();
42083
- _SingleStoreCountBuilder = class _SingleStoreCountBuilder extends (_c11 = SQL, _b295 = entityKind, _a391 = Symbol.toStringTag, _c11) {
42212
+ _SingleStoreCountBuilder = class _SingleStoreCountBuilder extends (_c12 = SQL, _b295 = entityKind, _a391 = Symbol.toStringTag, _c12) {
42084
42213
  constructor(params) {
42085
42214
  super(_SingleStoreCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
42086
42215
  __publicField(this, "sql");
@@ -42434,14 +42563,14 @@ function singlestoreTableWithSchema(name2, columns, extraConfig, schema5, baseNa
42434
42563
  }
42435
42564
  return table5;
42436
42565
  }
42437
- var _a395, _b298, _c12, _d5, SingleStoreTable;
42566
+ var _a395, _b298, _c13, _d5, SingleStoreTable;
42438
42567
  var init_table5 = __esm({
42439
42568
  "../drizzle-orm/dist/singlestore-core/table.js"() {
42440
42569
  "use strict";
42441
42570
  init_entity();
42442
42571
  init_table();
42443
42572
  init_all4();
42444
- SingleStoreTable = class extends (_d5 = Table2, _c12 = entityKind, _b298 = Table2.Symbol.Columns, _a395 = Table2.Symbol.ExtraConfigBuilder, _d5) {
42573
+ SingleStoreTable = class extends (_d5 = Table2, _c13 = entityKind, _b298 = Table2.Symbol.Columns, _a395 = Table2.Symbol.ExtraConfigBuilder, _d5) {
42445
42574
  constructor() {
42446
42575
  super(...arguments);
42447
42576
  /** @internal */
@@ -42450,7 +42579,7 @@ var init_table5 = __esm({
42450
42579
  __publicField(this, _a395);
42451
42580
  }
42452
42581
  };
42453
- __publicField(SingleStoreTable, _c12, "SingleStoreTable");
42582
+ __publicField(SingleStoreTable, _c13, "SingleStoreTable");
42454
42583
  /** @internal */
42455
42584
  __publicField(SingleStoreTable, "Symbol", Object.assign({}, Table2.Symbol, {}));
42456
42585
  }
@@ -44349,7 +44478,8 @@ function getTableConfig4(table5) {
44349
44478
  const extraConfigBuilder = table5[SingleStoreTable.Symbol.ExtraConfigBuilder];
44350
44479
  if (extraConfigBuilder !== void 0) {
44351
44480
  const extraConfig = extraConfigBuilder(table5[SingleStoreTable.Symbol.Columns]);
44352
- for (const builder of Object.values(extraConfig)) {
44481
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
44482
+ for (const builder of Object.values(extraValues)) {
44353
44483
  if (is(builder, IndexBuilder4)) {
44354
44484
  indexes.push(builder.build(table5));
44355
44485
  } else if (is(builder, UniqueConstraintBuilder4)) {