drizzle-kit 0.30.0-e14a5a2 → 0.30.1-05d907b

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 +308 -209
  2. package/api.mjs +308 -209
  3. package/bin.cjs +211 -8
  4. package/package.json +1 -1
package/api.js CHANGED
@@ -19719,7 +19719,8 @@ var init_common = __esm({
19719
19719
  schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
19720
19720
  migrations: configMigrations,
19721
19721
  dbCredentials: anyType().optional(),
19722
- casing: casingType.optional()
19722
+ casing: casingType.optional(),
19723
+ sql: booleanType().default(true)
19723
19724
  }).passthrough();
19724
19725
  casing = unionType([literalType("camel"), literalType("preserve")]).default(
19725
19726
  "camel"
@@ -21974,7 +21975,7 @@ var version;
21974
21975
  var init_version = __esm({
21975
21976
  "../drizzle-orm/dist/version.js"() {
21976
21977
  "use strict";
21977
- version = "0.38.0";
21978
+ version = "0.38.2";
21978
21979
  }
21979
21980
  });
21980
21981
 
@@ -37148,6 +37149,12 @@ var init_dialect3 = __esm({
37148
37149
  buildOrderBy(orderBy) {
37149
37150
  return orderBy && orderBy.length > 0 ? sql` order by ${sql.join(orderBy, sql`, `)}` : void 0;
37150
37151
  }
37152
+ buildIndex({
37153
+ indexes,
37154
+ indexFor
37155
+ }) {
37156
+ return indexes && indexes.length > 0 ? sql` ${sql.raw(indexFor)} INDEX (${sql.raw(indexes.join(`, `))})` : void 0;
37157
+ }
37151
37158
  buildSelectQuery({
37152
37159
  withList,
37153
37160
  fields,
@@ -37162,7 +37169,10 @@ var init_dialect3 = __esm({
37162
37169
  offset,
37163
37170
  lockingClause,
37164
37171
  distinct,
37165
- setOperators
37172
+ setOperators,
37173
+ useIndex,
37174
+ forceIndex,
37175
+ ignoreIndex
37166
37176
  }) {
37167
37177
  const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
37168
37178
  for (const f of fieldsList) {
@@ -37198,8 +37208,11 @@ var init_dialect3 = __esm({
37198
37208
  const tableSchema = table22[MySqlTable.Symbol.Schema];
37199
37209
  const origTableName = table22[MySqlTable.Symbol.OriginalName];
37200
37210
  const alias = tableName === origTableName ? void 0 : joinMeta.alias;
37211
+ const useIndexSql2 = this.buildIndex({ indexes: joinMeta.useIndex, indexFor: "USE" });
37212
+ const forceIndexSql2 = this.buildIndex({ indexes: joinMeta.forceIndex, indexFor: "FORCE" });
37213
+ const ignoreIndexSql2 = this.buildIndex({ indexes: joinMeta.ignoreIndex, indexFor: "IGNORE" });
37201
37214
  joinsArray.push(
37202
- 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}`
37215
+ 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}`
37203
37216
  );
37204
37217
  } else if (is(table22, View3)) {
37205
37218
  const viewName = table22[ViewBaseConfig].name;
@@ -37226,6 +37239,9 @@ var init_dialect3 = __esm({
37226
37239
  const groupBySql = groupBy && groupBy.length > 0 ? sql` group by ${sql.join(groupBy, sql`, `)}` : void 0;
37227
37240
  const limitSql = this.buildLimit(limit);
37228
37241
  const offsetSql = offset ? sql` offset ${offset}` : void 0;
37242
+ const useIndexSql = this.buildIndex({ indexes: useIndex, indexFor: "USE" });
37243
+ const forceIndexSql = this.buildIndex({ indexes: forceIndex, indexFor: "FORCE" });
37244
+ const ignoreIndexSql = this.buildIndex({ indexes: ignoreIndex, indexFor: "IGNORE" });
37229
37245
  let lockingClausesSql;
37230
37246
  if (lockingClause) {
37231
37247
  const { config, strength } = lockingClause;
@@ -37236,7 +37252,7 @@ var init_dialect3 = __esm({
37236
37252
  lockingClausesSql.append(sql` skip locked`);
37237
37253
  }
37238
37254
  }
37239
- const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClausesSql}`;
37255
+ const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${useIndexSql}${forceIndexSql}${ignoreIndexSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClausesSql}`;
37240
37256
  if (setOperators.length > 0) {
37241
37257
  return this.buildSetOperations(finalQuery, setOperators);
37242
37258
  }
@@ -37804,6 +37820,183 @@ var init_dialect3 = __esm({
37804
37820
  }
37805
37821
  });
37806
37822
 
37823
+ // ../drizzle-orm/dist/mysql-core/indexes.js
37824
+ var _a302, IndexBuilderOn3, _a303, IndexBuilder3, _a304, Index5;
37825
+ var init_indexes3 = __esm({
37826
+ "../drizzle-orm/dist/mysql-core/indexes.js"() {
37827
+ "use strict";
37828
+ init_entity();
37829
+ _a302 = entityKind;
37830
+ IndexBuilderOn3 = class {
37831
+ constructor(name2, unique) {
37832
+ this.name = name2;
37833
+ this.unique = unique;
37834
+ }
37835
+ on(...columns) {
37836
+ return new IndexBuilder3(this.name, columns, this.unique);
37837
+ }
37838
+ };
37839
+ __publicField(IndexBuilderOn3, _a302, "MySqlIndexBuilderOn");
37840
+ _a303 = entityKind;
37841
+ IndexBuilder3 = class {
37842
+ constructor(name2, columns, unique) {
37843
+ /** @internal */
37844
+ __publicField(this, "config");
37845
+ this.config = {
37846
+ name: name2,
37847
+ columns,
37848
+ unique
37849
+ };
37850
+ }
37851
+ using(using) {
37852
+ this.config.using = using;
37853
+ return this;
37854
+ }
37855
+ algorythm(algorythm) {
37856
+ this.config.algorythm = algorythm;
37857
+ return this;
37858
+ }
37859
+ lock(lock) {
37860
+ this.config.lock = lock;
37861
+ return this;
37862
+ }
37863
+ /** @internal */
37864
+ build(table5) {
37865
+ return new Index5(this.config, table5);
37866
+ }
37867
+ };
37868
+ __publicField(IndexBuilder3, _a303, "MySqlIndexBuilder");
37869
+ _a304 = entityKind;
37870
+ Index5 = class {
37871
+ constructor(config, table5) {
37872
+ __publicField(this, "config");
37873
+ this.config = { ...config, table: table5 };
37874
+ }
37875
+ };
37876
+ __publicField(Index5, _a304, "MySqlIndex");
37877
+ }
37878
+ });
37879
+
37880
+ // ../drizzle-orm/dist/mysql-core/primary-keys.js
37881
+ var _a305, PrimaryKeyBuilder3, _a306, PrimaryKey3;
37882
+ var init_primary_keys3 = __esm({
37883
+ "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
37884
+ "use strict";
37885
+ init_entity();
37886
+ init_table4();
37887
+ _a305 = entityKind;
37888
+ PrimaryKeyBuilder3 = class {
37889
+ constructor(columns, name2) {
37890
+ /** @internal */
37891
+ __publicField(this, "columns");
37892
+ /** @internal */
37893
+ __publicField(this, "name");
37894
+ this.columns = columns;
37895
+ this.name = name2;
37896
+ }
37897
+ /** @internal */
37898
+ build(table5) {
37899
+ return new PrimaryKey3(table5, this.columns, this.name);
37900
+ }
37901
+ };
37902
+ __publicField(PrimaryKeyBuilder3, _a305, "MySqlPrimaryKeyBuilder");
37903
+ _a306 = entityKind;
37904
+ PrimaryKey3 = class {
37905
+ constructor(table5, columns, name2) {
37906
+ __publicField(this, "columns");
37907
+ __publicField(this, "name");
37908
+ this.table = table5;
37909
+ this.columns = columns;
37910
+ this.name = name2;
37911
+ }
37912
+ getName() {
37913
+ return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column5) => column5.name).join("_")}_pk`;
37914
+ }
37915
+ };
37916
+ __publicField(PrimaryKey3, _a306, "MySqlPrimaryKey");
37917
+ }
37918
+ });
37919
+
37920
+ // ../drizzle-orm/dist/mysql-core/view-common.js
37921
+ var MySqlViewConfig;
37922
+ var init_view_common3 = __esm({
37923
+ "../drizzle-orm/dist/mysql-core/view-common.js"() {
37924
+ "use strict";
37925
+ MySqlViewConfig = Symbol.for("drizzle:MySqlViewConfig");
37926
+ }
37927
+ });
37928
+
37929
+ // ../drizzle-orm/dist/mysql-core/utils.js
37930
+ function getTableConfig3(table5) {
37931
+ const columns = Object.values(table5[MySqlTable.Symbol.Columns]);
37932
+ const indexes = [];
37933
+ const checks = [];
37934
+ const primaryKeys = [];
37935
+ const uniqueConstraints = [];
37936
+ const foreignKeys = Object.values(table5[MySqlTable.Symbol.InlineForeignKeys]);
37937
+ const name2 = table5[Table2.Symbol.Name];
37938
+ const schema5 = table5[Table2.Symbol.Schema];
37939
+ const baseName = table5[Table2.Symbol.BaseName];
37940
+ const extraConfigBuilder = table5[MySqlTable.Symbol.ExtraConfigBuilder];
37941
+ if (extraConfigBuilder !== void 0) {
37942
+ const extraConfig = extraConfigBuilder(table5[MySqlTable.Symbol.Columns]);
37943
+ const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
37944
+ for (const builder of Object.values(extraValues)) {
37945
+ if (is(builder, IndexBuilder3)) {
37946
+ indexes.push(builder.build(table5));
37947
+ } else if (is(builder, CheckBuilder3)) {
37948
+ checks.push(builder.build(table5));
37949
+ } else if (is(builder, UniqueConstraintBuilder3)) {
37950
+ uniqueConstraints.push(builder.build(table5));
37951
+ } else if (is(builder, PrimaryKeyBuilder3)) {
37952
+ primaryKeys.push(builder.build(table5));
37953
+ } else if (is(builder, ForeignKeyBuilder3)) {
37954
+ foreignKeys.push(builder.build(table5));
37955
+ }
37956
+ }
37957
+ }
37958
+ return {
37959
+ columns,
37960
+ indexes,
37961
+ foreignKeys,
37962
+ checks,
37963
+ primaryKeys,
37964
+ uniqueConstraints,
37965
+ name: name2,
37966
+ schema: schema5,
37967
+ baseName
37968
+ };
37969
+ }
37970
+ function getViewConfig3(view4) {
37971
+ return {
37972
+ ...view4[ViewBaseConfig],
37973
+ ...view4[MySqlViewConfig]
37974
+ };
37975
+ }
37976
+ function convertIndexToString(indexes) {
37977
+ return indexes.map((idx) => {
37978
+ return typeof idx === "object" ? idx.config.name : idx;
37979
+ });
37980
+ }
37981
+ function toArray(value) {
37982
+ return Array.isArray(value) ? value : [value];
37983
+ }
37984
+ var init_utils8 = __esm({
37985
+ "../drizzle-orm/dist/mysql-core/utils.js"() {
37986
+ "use strict";
37987
+ init_entity();
37988
+ init_table();
37989
+ init_view_common();
37990
+ init_checks3();
37991
+ init_foreign_keys3();
37992
+ init_indexes3();
37993
+ init_primary_keys3();
37994
+ init_table4();
37995
+ init_unique_constraint3();
37996
+ init_view_common3();
37997
+ }
37998
+ });
37999
+
37807
38000
  // ../drizzle-orm/dist/mysql-core/query-builders/select.js
37808
38001
  function createSetOperator3(type, isAll) {
37809
38002
  return (leftSelect, rightSelect, ...restSelects) => {
@@ -37822,11 +38015,12 @@ function createSetOperator3(type, isAll) {
37822
38015
  return leftSelect.addSetOperators(setOperators);
37823
38016
  };
37824
38017
  }
37825
- var _a302, MySqlSelectBuilder, _a303, _b224, MySqlSelectQueryBuilderBase, _a304, _b225, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
38018
+ var _a307, MySqlSelectBuilder, _a308, _b224, MySqlSelectQueryBuilderBase, _a309, _b225, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
37826
38019
  var init_select4 = __esm({
37827
38020
  "../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
37828
38021
  "use strict";
37829
38022
  init_entity();
38023
+ init_table4();
37830
38024
  init_query_builder();
37831
38025
  init_query_promise();
37832
38026
  init_selection_proxy();
@@ -37834,10 +38028,10 @@ var init_select4 = __esm({
37834
38028
  init_subquery();
37835
38029
  init_table();
37836
38030
  init_utils2();
37837
- init_utils2();
37838
38031
  init_view_common();
38032
+ init_utils8();
37839
38033
  init_view_base3();
37840
- _a302 = entityKind;
38034
+ _a307 = entityKind;
37841
38035
  MySqlSelectBuilder = class {
37842
38036
  constructor(config) {
37843
38037
  __publicField(this, "fields");
@@ -37853,7 +38047,7 @@ var init_select4 = __esm({
37853
38047
  }
37854
38048
  this.distinct = config.distinct;
37855
38049
  }
37856
- from(source) {
38050
+ from(source, onIndex) {
37857
38051
  const isPartialSelect = !!this.fields;
37858
38052
  let fields;
37859
38053
  if (this.fields) {
@@ -37869,6 +38063,20 @@ var init_select4 = __esm({
37869
38063
  } else {
37870
38064
  fields = getTableColumns(source);
37871
38065
  }
38066
+ let useIndex = [];
38067
+ let forceIndex = [];
38068
+ let ignoreIndex = [];
38069
+ if (is(source, MySqlTable) && onIndex && typeof onIndex !== "string") {
38070
+ if (onIndex.useIndex) {
38071
+ useIndex = convertIndexToString(toArray(onIndex.useIndex));
38072
+ }
38073
+ if (onIndex.forceIndex) {
38074
+ forceIndex = convertIndexToString(toArray(onIndex.forceIndex));
38075
+ }
38076
+ if (onIndex.ignoreIndex) {
38077
+ ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex));
38078
+ }
38079
+ }
37872
38080
  return new MySqlSelectBase(
37873
38081
  {
37874
38082
  table: source,
@@ -37877,14 +38085,17 @@ var init_select4 = __esm({
37877
38085
  session: this.session,
37878
38086
  dialect: this.dialect,
37879
38087
  withList: this.withList,
37880
- distinct: this.distinct
38088
+ distinct: this.distinct,
38089
+ useIndex,
38090
+ forceIndex,
38091
+ ignoreIndex
37881
38092
  }
37882
38093
  );
37883
38094
  }
37884
38095
  };
37885
- __publicField(MySqlSelectBuilder, _a302, "MySqlSelectBuilder");
37886
- MySqlSelectQueryBuilderBase = class extends (_b224 = TypedQueryBuilder, _a303 = entityKind, _b224) {
37887
- constructor({ table: table5, fields, isPartialSelect, session, dialect: dialect6, withList, distinct }) {
38096
+ __publicField(MySqlSelectBuilder, _a307, "MySqlSelectBuilder");
38097
+ MySqlSelectQueryBuilderBase = class extends (_b224 = TypedQueryBuilder, _a308 = entityKind, _b224) {
38098
+ constructor({ table: table5, fields, isPartialSelect, session, dialect: dialect6, withList, distinct, useIndex, forceIndex, ignoreIndex }) {
37888
38099
  super();
37889
38100
  __publicField(this, "_");
37890
38101
  __publicField(this, "config");
@@ -37919,6 +38130,16 @@ var init_select4 = __esm({
37919
38130
  * })
37920
38131
  * .from(users)
37921
38132
  * .leftJoin(pets, eq(users.id, pets.ownerId))
38133
+ *
38134
+ * // Select userId and petId with use index hint
38135
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38136
+ * userId: users.id,
38137
+ * petId: pets.id,
38138
+ * })
38139
+ * .from(users)
38140
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38141
+ * useIndex: ['pets_owner_id_index']
38142
+ * })
37922
38143
  * ```
37923
38144
  */
37924
38145
  __publicField(this, "leftJoin", this.createJoin("left"));
@@ -37947,6 +38168,16 @@ var init_select4 = __esm({
37947
38168
  * })
37948
38169
  * .from(users)
37949
38170
  * .rightJoin(pets, eq(users.id, pets.ownerId))
38171
+ *
38172
+ * // Select userId and petId with use index hint
38173
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38174
+ * userId: users.id,
38175
+ * petId: pets.id,
38176
+ * })
38177
+ * .from(users)
38178
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38179
+ * useIndex: ['pets_owner_id_index']
38180
+ * })
37950
38181
  * ```
37951
38182
  */
37952
38183
  __publicField(this, "rightJoin", this.createJoin("right"));
@@ -37975,6 +38206,16 @@ var init_select4 = __esm({
37975
38206
  * })
37976
38207
  * .from(users)
37977
38208
  * .innerJoin(pets, eq(users.id, pets.ownerId))
38209
+ *
38210
+ * // Select userId and petId with use index hint
38211
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38212
+ * userId: users.id,
38213
+ * petId: pets.id,
38214
+ * })
38215
+ * .from(users)
38216
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38217
+ * useIndex: ['pets_owner_id_index']
38218
+ * })
37978
38219
  * ```
37979
38220
  */
37980
38221
  __publicField(this, "innerJoin", this.createJoin("inner"));
@@ -38003,6 +38244,16 @@ var init_select4 = __esm({
38003
38244
  * })
38004
38245
  * .from(users)
38005
38246
  * .fullJoin(pets, eq(users.id, pets.ownerId))
38247
+ *
38248
+ * // Select userId and petId with use index hint
38249
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
38250
+ * userId: users.id,
38251
+ * petId: pets.id,
38252
+ * })
38253
+ * .from(users)
38254
+ * .leftJoin(pets, eq(users.id, pets.ownerId), {
38255
+ * useIndex: ['pets_owner_id_index']
38256
+ * })
38006
38257
  * ```
38007
38258
  */
38008
38259
  __publicField(this, "fullJoin", this.createJoin("full"));
@@ -38197,7 +38448,10 @@ var init_select4 = __esm({
38197
38448
  table: table5,
38198
38449
  fields: { ...fields },
38199
38450
  distinct,
38200
- setOperators: []
38451
+ setOperators: [],
38452
+ useIndex,
38453
+ forceIndex,
38454
+ ignoreIndex
38201
38455
  };
38202
38456
  this.isPartialSelect = isPartialSelect;
38203
38457
  this.session = session;
@@ -38209,7 +38463,7 @@ var init_select4 = __esm({
38209
38463
  this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
38210
38464
  }
38211
38465
  createJoin(joinType) {
38212
- return (table5, on) => {
38466
+ return (table5, on, onIndex) => {
38213
38467
  const baseTableName = this.tableName;
38214
38468
  const tableName = getTableLikeName(table5);
38215
38469
  if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
@@ -38237,7 +38491,21 @@ var init_select4 = __esm({
38237
38491
  if (!this.config.joins) {
38238
38492
  this.config.joins = [];
38239
38493
  }
38240
- this.config.joins.push({ on, table: table5, joinType, alias: tableName });
38494
+ let useIndex = [];
38495
+ let forceIndex = [];
38496
+ let ignoreIndex = [];
38497
+ if (is(table5, MySqlTable) && onIndex && typeof onIndex !== "string") {
38498
+ if (onIndex.useIndex) {
38499
+ useIndex = convertIndexToString(toArray(onIndex.useIndex));
38500
+ }
38501
+ if (onIndex.forceIndex) {
38502
+ forceIndex = convertIndexToString(toArray(onIndex.forceIndex));
38503
+ }
38504
+ if (onIndex.ignoreIndex) {
38505
+ ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex));
38506
+ }
38507
+ }
38508
+ this.config.joins.push({ on, table: table5, joinType, alias: tableName, useIndex, forceIndex, ignoreIndex });
38241
38509
  if (typeof tableName === "string") {
38242
38510
  switch (joinType) {
38243
38511
  case "left": {
@@ -38484,8 +38752,8 @@ var init_select4 = __esm({
38484
38752
  return this;
38485
38753
  }
38486
38754
  };
38487
- __publicField(MySqlSelectQueryBuilderBase, _a303, "MySqlSelectQueryBuilder");
38488
- MySqlSelectBase = class extends (_b225 = MySqlSelectQueryBuilderBase, _a304 = entityKind, _b225) {
38755
+ __publicField(MySqlSelectQueryBuilderBase, _a308, "MySqlSelectQueryBuilder");
38756
+ MySqlSelectBase = class extends (_b225 = MySqlSelectQueryBuilderBase, _a309 = entityKind, _b225) {
38489
38757
  constructor() {
38490
38758
  super(...arguments);
38491
38759
  __publicField(this, "execute", (placeholderValues) => {
@@ -38509,7 +38777,7 @@ var init_select4 = __esm({
38509
38777
  return query;
38510
38778
  }
38511
38779
  };
38512
- __publicField(MySqlSelectBase, _a304, "MySqlSelect");
38780
+ __publicField(MySqlSelectBase, _a309, "MySqlSelect");
38513
38781
  applyMixins(MySqlSelectBase, [QueryPromise]);
38514
38782
  getMySqlSetOperators = () => ({
38515
38783
  union: union3,
@@ -38529,7 +38797,7 @@ var init_select4 = __esm({
38529
38797
  });
38530
38798
 
38531
38799
  // ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
38532
- var _a305, QueryBuilder3;
38800
+ var _a310, QueryBuilder3;
38533
38801
  var init_query_builder4 = __esm({
38534
38802
  "../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
38535
38803
  "use strict";
@@ -38538,7 +38806,7 @@ var init_query_builder4 = __esm({
38538
38806
  init_selection_proxy();
38539
38807
  init_subquery();
38540
38808
  init_select4();
38541
- _a305 = entityKind;
38809
+ _a310 = entityKind;
38542
38810
  QueryBuilder3 = class {
38543
38811
  constructor(dialect6) {
38544
38812
  __publicField(this, "dialect");
@@ -38600,12 +38868,12 @@ var init_query_builder4 = __esm({
38600
38868
  return this.dialect;
38601
38869
  }
38602
38870
  };
38603
- __publicField(QueryBuilder3, _a305, "MySqlQueryBuilder");
38871
+ __publicField(QueryBuilder3, _a310, "MySqlQueryBuilder");
38604
38872
  }
38605
38873
  });
38606
38874
 
38607
38875
  // ../drizzle-orm/dist/mysql-core/query-builders/insert.js
38608
- var _a306, MySqlInsertBuilder, _a307, _b226, MySqlInsertBase;
38876
+ var _a311, MySqlInsertBuilder, _a312, _b226, MySqlInsertBase;
38609
38877
  var init_insert3 = __esm({
38610
38878
  "../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
38611
38879
  "use strict";
@@ -38615,7 +38883,7 @@ var init_insert3 = __esm({
38615
38883
  init_table();
38616
38884
  init_utils2();
38617
38885
  init_query_builder4();
38618
- _a306 = entityKind;
38886
+ _a311 = entityKind;
38619
38887
  MySqlInsertBuilder = class {
38620
38888
  constructor(table5, session, dialect6) {
38621
38889
  __publicField(this, "shouldIgnore", false);
@@ -38653,8 +38921,8 @@ var init_insert3 = __esm({
38653
38921
  return new MySqlInsertBase(this.table, select, this.shouldIgnore, this.session, this.dialect, true);
38654
38922
  }
38655
38923
  };
38656
- __publicField(MySqlInsertBuilder, _a306, "MySqlInsertBuilder");
38657
- MySqlInsertBase = class extends (_b226 = QueryPromise, _a307 = entityKind, _b226) {
38924
+ __publicField(MySqlInsertBuilder, _a311, "MySqlInsertBuilder");
38925
+ MySqlInsertBase = class extends (_b226 = QueryPromise, _a312 = entityKind, _b226) {
38658
38926
  constructor(table5, values, ignore, session, dialect6, select) {
38659
38927
  super();
38660
38928
  __publicField(this, "config");
@@ -38735,7 +39003,7 @@ var init_insert3 = __esm({
38735
39003
  return this;
38736
39004
  }
38737
39005
  };
38738
- __publicField(MySqlInsertBase, _a307, "MySqlInsert");
39006
+ __publicField(MySqlInsertBase, _a312, "MySqlInsert");
38739
39007
  }
38740
39008
  });
38741
39009
 
@@ -38747,7 +39015,7 @@ var init_select_types3 = __esm({
38747
39015
  });
38748
39016
 
38749
39017
  // ../drizzle-orm/dist/mysql-core/query-builders/update.js
38750
- var _a308, MySqlUpdateBuilder, _a309, _b227, MySqlUpdateBase;
39018
+ var _a313, MySqlUpdateBuilder, _a314, _b227, MySqlUpdateBase;
38751
39019
  var init_update3 = __esm({
38752
39020
  "../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
38753
39021
  "use strict";
@@ -38756,7 +39024,7 @@ var init_update3 = __esm({
38756
39024
  init_selection_proxy();
38757
39025
  init_table();
38758
39026
  init_utils2();
38759
- _a308 = entityKind;
39027
+ _a313 = entityKind;
38760
39028
  MySqlUpdateBuilder = class {
38761
39029
  constructor(table5, session, dialect6, withList) {
38762
39030
  this.table = table5;
@@ -38768,8 +39036,8 @@ var init_update3 = __esm({
38768
39036
  return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
38769
39037
  }
38770
39038
  };
38771
- __publicField(MySqlUpdateBuilder, _a308, "MySqlUpdateBuilder");
38772
- MySqlUpdateBase = class extends (_b227 = QueryPromise, _a309 = entityKind, _b227) {
39039
+ __publicField(MySqlUpdateBuilder, _a313, "MySqlUpdateBuilder");
39040
+ MySqlUpdateBase = class extends (_b227 = QueryPromise, _a314 = entityKind, _b227) {
38773
39041
  constructor(table5, set, session, dialect6, withList) {
38774
39042
  super();
38775
39043
  __publicField(this, "config");
@@ -38862,7 +39130,7 @@ var init_update3 = __esm({
38862
39130
  return this;
38863
39131
  }
38864
39132
  };
38865
- __publicField(MySqlUpdateBase, _a309, "MySqlUpdate");
39133
+ __publicField(MySqlUpdateBase, _a314, "MySqlUpdate");
38866
39134
  }
38867
39135
  });
38868
39136
 
@@ -38880,14 +39148,14 @@ var init_query_builders3 = __esm({
38880
39148
  });
38881
39149
 
38882
39150
  // ../drizzle-orm/dist/mysql-core/query-builders/query.js
38883
- var _a310, RelationalQueryBuilder3, _a311, _b228, MySqlRelationalQuery;
39151
+ var _a315, RelationalQueryBuilder3, _a316, _b228, MySqlRelationalQuery;
38884
39152
  var init_query3 = __esm({
38885
39153
  "../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
38886
39154
  "use strict";
38887
39155
  init_entity();
38888
39156
  init_query_promise();
38889
39157
  init_relations();
38890
- _a310 = entityKind;
39158
+ _a315 = entityKind;
38891
39159
  RelationalQueryBuilder3 = class {
38892
39160
  constructor(fullSchema, schema5, tableNamesMap, table5, tableConfig, dialect6, session, mode) {
38893
39161
  this.fullSchema = fullSchema;
@@ -38928,8 +39196,8 @@ var init_query3 = __esm({
38928
39196
  );
38929
39197
  }
38930
39198
  };
38931
- __publicField(RelationalQueryBuilder3, _a310, "MySqlRelationalQueryBuilder");
38932
- MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a311 = entityKind, _b228) {
39199
+ __publicField(RelationalQueryBuilder3, _a315, "MySqlRelationalQueryBuilder");
39200
+ MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a316 = entityKind, _b228) {
38933
39201
  constructor(fullSchema, schema5, tableNamesMap, table5, tableConfig, dialect6, session, config, queryMode, mode) {
38934
39202
  super();
38935
39203
  this.fullSchema = fullSchema;
@@ -38993,12 +39261,12 @@ var init_query3 = __esm({
38993
39261
  return this.prepare().execute();
38994
39262
  }
38995
39263
  };
38996
- __publicField(MySqlRelationalQuery, _a311, "MySqlRelationalQuery");
39264
+ __publicField(MySqlRelationalQuery, _a316, "MySqlRelationalQuery");
38997
39265
  }
38998
39266
  });
38999
39267
 
39000
39268
  // ../drizzle-orm/dist/mysql-core/db.js
39001
- var _a312, MySqlDatabase;
39269
+ var _a317, MySqlDatabase;
39002
39270
  var init_db3 = __esm({
39003
39271
  "../drizzle-orm/dist/mysql-core/db.js"() {
39004
39272
  "use strict";
@@ -39009,7 +39277,7 @@ var init_db3 = __esm({
39009
39277
  init_count3();
39010
39278
  init_query_builders3();
39011
39279
  init_query3();
39012
- _a312 = entityKind;
39280
+ _a317 = entityKind;
39013
39281
  MySqlDatabase = class {
39014
39282
  constructor(dialect6, session, schema5, mode) {
39015
39283
  __publicField(this, "query");
@@ -39222,113 +39490,7 @@ var init_db3 = __esm({
39222
39490
  return this.session.transaction(transaction, config);
39223
39491
  }
39224
39492
  };
39225
- __publicField(MySqlDatabase, _a312, "MySqlDatabase");
39226
- }
39227
- });
39228
-
39229
- // ../drizzle-orm/dist/mysql-core/indexes.js
39230
- var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
39231
- var init_indexes3 = __esm({
39232
- "../drizzle-orm/dist/mysql-core/indexes.js"() {
39233
- "use strict";
39234
- init_entity();
39235
- _a313 = entityKind;
39236
- IndexBuilderOn3 = class {
39237
- constructor(name2, unique) {
39238
- this.name = name2;
39239
- this.unique = unique;
39240
- }
39241
- on(...columns) {
39242
- return new IndexBuilder3(this.name, columns, this.unique);
39243
- }
39244
- };
39245
- __publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
39246
- _a314 = entityKind;
39247
- IndexBuilder3 = class {
39248
- constructor(name2, columns, unique) {
39249
- /** @internal */
39250
- __publicField(this, "config");
39251
- this.config = {
39252
- name: name2,
39253
- columns,
39254
- unique
39255
- };
39256
- }
39257
- using(using) {
39258
- this.config.using = using;
39259
- return this;
39260
- }
39261
- algorythm(algorythm) {
39262
- this.config.algorythm = algorythm;
39263
- return this;
39264
- }
39265
- lock(lock) {
39266
- this.config.lock = lock;
39267
- return this;
39268
- }
39269
- /** @internal */
39270
- build(table5) {
39271
- return new Index5(this.config, table5);
39272
- }
39273
- };
39274
- __publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
39275
- _a315 = entityKind;
39276
- Index5 = class {
39277
- constructor(config, table5) {
39278
- __publicField(this, "config");
39279
- this.config = { ...config, table: table5 };
39280
- }
39281
- };
39282
- __publicField(Index5, _a315, "MySqlIndex");
39283
- }
39284
- });
39285
-
39286
- // ../drizzle-orm/dist/mysql-core/primary-keys.js
39287
- var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
39288
- var init_primary_keys3 = __esm({
39289
- "../drizzle-orm/dist/mysql-core/primary-keys.js"() {
39290
- "use strict";
39291
- init_entity();
39292
- init_table4();
39293
- _a316 = entityKind;
39294
- PrimaryKeyBuilder3 = class {
39295
- constructor(columns, name2) {
39296
- /** @internal */
39297
- __publicField(this, "columns");
39298
- /** @internal */
39299
- __publicField(this, "name");
39300
- this.columns = columns;
39301
- this.name = name2;
39302
- }
39303
- /** @internal */
39304
- build(table5) {
39305
- return new PrimaryKey3(table5, this.columns, this.name);
39306
- }
39307
- };
39308
- __publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
39309
- _a317 = entityKind;
39310
- PrimaryKey3 = class {
39311
- constructor(table5, columns, name2) {
39312
- __publicField(this, "columns");
39313
- __publicField(this, "name");
39314
- this.table = table5;
39315
- this.columns = columns;
39316
- this.name = name2;
39317
- }
39318
- getName() {
39319
- return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column5) => column5.name).join("_")}_pk`;
39320
- }
39321
- };
39322
- __publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
39323
- }
39324
- });
39325
-
39326
- // ../drizzle-orm/dist/mysql-core/view-common.js
39327
- var MySqlViewConfig;
39328
- var init_view_common3 = __esm({
39329
- "../drizzle-orm/dist/mysql-core/view-common.js"() {
39330
- "use strict";
39331
- MySqlViewConfig = Symbol.for("drizzle:MySqlViewConfig");
39493
+ __publicField(MySqlDatabase, _a317, "MySqlDatabase");
39332
39494
  }
39333
39495
  });
39334
39496
 
@@ -39553,69 +39715,6 @@ var init_subquery4 = __esm({
39553
39715
  }
39554
39716
  });
39555
39717
 
39556
- // ../drizzle-orm/dist/mysql-core/utils.js
39557
- function getTableConfig3(table5) {
39558
- const columns = Object.values(table5[MySqlTable.Symbol.Columns]);
39559
- const indexes = [];
39560
- const checks = [];
39561
- const primaryKeys = [];
39562
- const uniqueConstraints = [];
39563
- const foreignKeys = Object.values(table5[MySqlTable.Symbol.InlineForeignKeys]);
39564
- const name2 = table5[Table2.Symbol.Name];
39565
- const schema5 = table5[Table2.Symbol.Schema];
39566
- const baseName = table5[Table2.Symbol.BaseName];
39567
- const extraConfigBuilder = table5[MySqlTable.Symbol.ExtraConfigBuilder];
39568
- if (extraConfigBuilder !== void 0) {
39569
- const extraConfig = extraConfigBuilder(table5[MySqlTable.Symbol.Columns]);
39570
- const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
39571
- for (const builder of Object.values(extraValues)) {
39572
- if (is(builder, IndexBuilder3)) {
39573
- indexes.push(builder.build(table5));
39574
- } else if (is(builder, CheckBuilder3)) {
39575
- checks.push(builder.build(table5));
39576
- } else if (is(builder, UniqueConstraintBuilder3)) {
39577
- uniqueConstraints.push(builder.build(table5));
39578
- } else if (is(builder, PrimaryKeyBuilder3)) {
39579
- primaryKeys.push(builder.build(table5));
39580
- } else if (is(builder, ForeignKeyBuilder3)) {
39581
- foreignKeys.push(builder.build(table5));
39582
- }
39583
- }
39584
- }
39585
- return {
39586
- columns,
39587
- indexes,
39588
- foreignKeys,
39589
- checks,
39590
- primaryKeys,
39591
- uniqueConstraints,
39592
- name: name2,
39593
- schema: schema5,
39594
- baseName
39595
- };
39596
- }
39597
- function getViewConfig3(view4) {
39598
- return {
39599
- ...view4[ViewBaseConfig],
39600
- ...view4[MySqlViewConfig]
39601
- };
39602
- }
39603
- var init_utils8 = __esm({
39604
- "../drizzle-orm/dist/mysql-core/utils.js"() {
39605
- "use strict";
39606
- init_entity();
39607
- init_table();
39608
- init_view_common();
39609
- init_checks3();
39610
- init_foreign_keys3();
39611
- init_indexes3();
39612
- init_primary_keys3();
39613
- init_table4();
39614
- init_unique_constraint3();
39615
- init_view_common3();
39616
- }
39617
- });
39618
-
39619
39718
  // ../drizzle-orm/dist/mysql-core/index.js
39620
39719
  var init_mysql_core = __esm({
39621
39720
  "../drizzle-orm/dist/mysql-core/index.js"() {