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.
- package/api.js +308 -209
- package/api.mjs +308 -209
- package/bin.cjs +211 -8
- package/package.json +1 -1
package/api.mjs
CHANGED
@@ -19724,7 +19724,8 @@ var init_common = __esm({
|
|
19724
19724
|
schemaFilter: unionType([stringType(), stringType().array()]).default(["public"]),
|
19725
19725
|
migrations: configMigrations,
|
19726
19726
|
dbCredentials: anyType().optional(),
|
19727
|
-
casing: casingType.optional()
|
19727
|
+
casing: casingType.optional(),
|
19728
|
+
sql: booleanType().default(true)
|
19728
19729
|
}).passthrough();
|
19729
19730
|
casing = unionType([literalType("camel"), literalType("preserve")]).default(
|
19730
19731
|
"camel"
|
@@ -21979,7 +21980,7 @@ var version;
|
|
21979
21980
|
var init_version = __esm({
|
21980
21981
|
"../drizzle-orm/dist/version.js"() {
|
21981
21982
|
"use strict";
|
21982
|
-
version = "0.38.
|
21983
|
+
version = "0.38.2";
|
21983
21984
|
}
|
21984
21985
|
});
|
21985
21986
|
|
@@ -37153,6 +37154,12 @@ var init_dialect3 = __esm({
|
|
37153
37154
|
buildOrderBy(orderBy) {
|
37154
37155
|
return orderBy && orderBy.length > 0 ? sql` order by ${sql.join(orderBy, sql`, `)}` : void 0;
|
37155
37156
|
}
|
37157
|
+
buildIndex({
|
37158
|
+
indexes,
|
37159
|
+
indexFor
|
37160
|
+
}) {
|
37161
|
+
return indexes && indexes.length > 0 ? sql` ${sql.raw(indexFor)} INDEX (${sql.raw(indexes.join(`, `))})` : void 0;
|
37162
|
+
}
|
37156
37163
|
buildSelectQuery({
|
37157
37164
|
withList,
|
37158
37165
|
fields,
|
@@ -37167,7 +37174,10 @@ var init_dialect3 = __esm({
|
|
37167
37174
|
offset,
|
37168
37175
|
lockingClause,
|
37169
37176
|
distinct,
|
37170
|
-
setOperators
|
37177
|
+
setOperators,
|
37178
|
+
useIndex,
|
37179
|
+
forceIndex,
|
37180
|
+
ignoreIndex
|
37171
37181
|
}) {
|
37172
37182
|
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
|
37173
37183
|
for (const f of fieldsList) {
|
@@ -37203,8 +37213,11 @@ var init_dialect3 = __esm({
|
|
37203
37213
|
const tableSchema = table22[MySqlTable.Symbol.Schema];
|
37204
37214
|
const origTableName = table22[MySqlTable.Symbol.OriginalName];
|
37205
37215
|
const alias = tableName === origTableName ? void 0 : joinMeta.alias;
|
37216
|
+
const useIndexSql2 = this.buildIndex({ indexes: joinMeta.useIndex, indexFor: "USE" });
|
37217
|
+
const forceIndexSql2 = this.buildIndex({ indexes: joinMeta.forceIndex, indexFor: "FORCE" });
|
37218
|
+
const ignoreIndexSql2 = this.buildIndex({ indexes: joinMeta.ignoreIndex, indexFor: "IGNORE" });
|
37206
37219
|
joinsArray.push(
|
37207
|
-
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}`
|
37220
|
+
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}`
|
37208
37221
|
);
|
37209
37222
|
} else if (is(table22, View3)) {
|
37210
37223
|
const viewName = table22[ViewBaseConfig].name;
|
@@ -37231,6 +37244,9 @@ var init_dialect3 = __esm({
|
|
37231
37244
|
const groupBySql = groupBy && groupBy.length > 0 ? sql` group by ${sql.join(groupBy, sql`, `)}` : void 0;
|
37232
37245
|
const limitSql = this.buildLimit(limit);
|
37233
37246
|
const offsetSql = offset ? sql` offset ${offset}` : void 0;
|
37247
|
+
const useIndexSql = this.buildIndex({ indexes: useIndex, indexFor: "USE" });
|
37248
|
+
const forceIndexSql = this.buildIndex({ indexes: forceIndex, indexFor: "FORCE" });
|
37249
|
+
const ignoreIndexSql = this.buildIndex({ indexes: ignoreIndex, indexFor: "IGNORE" });
|
37234
37250
|
let lockingClausesSql;
|
37235
37251
|
if (lockingClause) {
|
37236
37252
|
const { config, strength } = lockingClause;
|
@@ -37241,7 +37257,7 @@ var init_dialect3 = __esm({
|
|
37241
37257
|
lockingClausesSql.append(sql` skip locked`);
|
37242
37258
|
}
|
37243
37259
|
}
|
37244
|
-
const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClausesSql}`;
|
37260
|
+
const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${useIndexSql}${forceIndexSql}${ignoreIndexSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClausesSql}`;
|
37245
37261
|
if (setOperators.length > 0) {
|
37246
37262
|
return this.buildSetOperations(finalQuery, setOperators);
|
37247
37263
|
}
|
@@ -37809,6 +37825,183 @@ var init_dialect3 = __esm({
|
|
37809
37825
|
}
|
37810
37826
|
});
|
37811
37827
|
|
37828
|
+
// ../drizzle-orm/dist/mysql-core/indexes.js
|
37829
|
+
var _a302, IndexBuilderOn3, _a303, IndexBuilder3, _a304, Index5;
|
37830
|
+
var init_indexes3 = __esm({
|
37831
|
+
"../drizzle-orm/dist/mysql-core/indexes.js"() {
|
37832
|
+
"use strict";
|
37833
|
+
init_entity();
|
37834
|
+
_a302 = entityKind;
|
37835
|
+
IndexBuilderOn3 = class {
|
37836
|
+
constructor(name2, unique) {
|
37837
|
+
this.name = name2;
|
37838
|
+
this.unique = unique;
|
37839
|
+
}
|
37840
|
+
on(...columns) {
|
37841
|
+
return new IndexBuilder3(this.name, columns, this.unique);
|
37842
|
+
}
|
37843
|
+
};
|
37844
|
+
__publicField(IndexBuilderOn3, _a302, "MySqlIndexBuilderOn");
|
37845
|
+
_a303 = entityKind;
|
37846
|
+
IndexBuilder3 = class {
|
37847
|
+
constructor(name2, columns, unique) {
|
37848
|
+
/** @internal */
|
37849
|
+
__publicField(this, "config");
|
37850
|
+
this.config = {
|
37851
|
+
name: name2,
|
37852
|
+
columns,
|
37853
|
+
unique
|
37854
|
+
};
|
37855
|
+
}
|
37856
|
+
using(using) {
|
37857
|
+
this.config.using = using;
|
37858
|
+
return this;
|
37859
|
+
}
|
37860
|
+
algorythm(algorythm) {
|
37861
|
+
this.config.algorythm = algorythm;
|
37862
|
+
return this;
|
37863
|
+
}
|
37864
|
+
lock(lock) {
|
37865
|
+
this.config.lock = lock;
|
37866
|
+
return this;
|
37867
|
+
}
|
37868
|
+
/** @internal */
|
37869
|
+
build(table5) {
|
37870
|
+
return new Index5(this.config, table5);
|
37871
|
+
}
|
37872
|
+
};
|
37873
|
+
__publicField(IndexBuilder3, _a303, "MySqlIndexBuilder");
|
37874
|
+
_a304 = entityKind;
|
37875
|
+
Index5 = class {
|
37876
|
+
constructor(config, table5) {
|
37877
|
+
__publicField(this, "config");
|
37878
|
+
this.config = { ...config, table: table5 };
|
37879
|
+
}
|
37880
|
+
};
|
37881
|
+
__publicField(Index5, _a304, "MySqlIndex");
|
37882
|
+
}
|
37883
|
+
});
|
37884
|
+
|
37885
|
+
// ../drizzle-orm/dist/mysql-core/primary-keys.js
|
37886
|
+
var _a305, PrimaryKeyBuilder3, _a306, PrimaryKey3;
|
37887
|
+
var init_primary_keys3 = __esm({
|
37888
|
+
"../drizzle-orm/dist/mysql-core/primary-keys.js"() {
|
37889
|
+
"use strict";
|
37890
|
+
init_entity();
|
37891
|
+
init_table4();
|
37892
|
+
_a305 = entityKind;
|
37893
|
+
PrimaryKeyBuilder3 = class {
|
37894
|
+
constructor(columns, name2) {
|
37895
|
+
/** @internal */
|
37896
|
+
__publicField(this, "columns");
|
37897
|
+
/** @internal */
|
37898
|
+
__publicField(this, "name");
|
37899
|
+
this.columns = columns;
|
37900
|
+
this.name = name2;
|
37901
|
+
}
|
37902
|
+
/** @internal */
|
37903
|
+
build(table5) {
|
37904
|
+
return new PrimaryKey3(table5, this.columns, this.name);
|
37905
|
+
}
|
37906
|
+
};
|
37907
|
+
__publicField(PrimaryKeyBuilder3, _a305, "MySqlPrimaryKeyBuilder");
|
37908
|
+
_a306 = entityKind;
|
37909
|
+
PrimaryKey3 = class {
|
37910
|
+
constructor(table5, columns, name2) {
|
37911
|
+
__publicField(this, "columns");
|
37912
|
+
__publicField(this, "name");
|
37913
|
+
this.table = table5;
|
37914
|
+
this.columns = columns;
|
37915
|
+
this.name = name2;
|
37916
|
+
}
|
37917
|
+
getName() {
|
37918
|
+
return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column5) => column5.name).join("_")}_pk`;
|
37919
|
+
}
|
37920
|
+
};
|
37921
|
+
__publicField(PrimaryKey3, _a306, "MySqlPrimaryKey");
|
37922
|
+
}
|
37923
|
+
});
|
37924
|
+
|
37925
|
+
// ../drizzle-orm/dist/mysql-core/view-common.js
|
37926
|
+
var MySqlViewConfig;
|
37927
|
+
var init_view_common3 = __esm({
|
37928
|
+
"../drizzle-orm/dist/mysql-core/view-common.js"() {
|
37929
|
+
"use strict";
|
37930
|
+
MySqlViewConfig = Symbol.for("drizzle:MySqlViewConfig");
|
37931
|
+
}
|
37932
|
+
});
|
37933
|
+
|
37934
|
+
// ../drizzle-orm/dist/mysql-core/utils.js
|
37935
|
+
function getTableConfig3(table5) {
|
37936
|
+
const columns = Object.values(table5[MySqlTable.Symbol.Columns]);
|
37937
|
+
const indexes = [];
|
37938
|
+
const checks = [];
|
37939
|
+
const primaryKeys = [];
|
37940
|
+
const uniqueConstraints = [];
|
37941
|
+
const foreignKeys = Object.values(table5[MySqlTable.Symbol.InlineForeignKeys]);
|
37942
|
+
const name2 = table5[Table2.Symbol.Name];
|
37943
|
+
const schema5 = table5[Table2.Symbol.Schema];
|
37944
|
+
const baseName = table5[Table2.Symbol.BaseName];
|
37945
|
+
const extraConfigBuilder = table5[MySqlTable.Symbol.ExtraConfigBuilder];
|
37946
|
+
if (extraConfigBuilder !== void 0) {
|
37947
|
+
const extraConfig = extraConfigBuilder(table5[MySqlTable.Symbol.Columns]);
|
37948
|
+
const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
|
37949
|
+
for (const builder of Object.values(extraValues)) {
|
37950
|
+
if (is(builder, IndexBuilder3)) {
|
37951
|
+
indexes.push(builder.build(table5));
|
37952
|
+
} else if (is(builder, CheckBuilder3)) {
|
37953
|
+
checks.push(builder.build(table5));
|
37954
|
+
} else if (is(builder, UniqueConstraintBuilder3)) {
|
37955
|
+
uniqueConstraints.push(builder.build(table5));
|
37956
|
+
} else if (is(builder, PrimaryKeyBuilder3)) {
|
37957
|
+
primaryKeys.push(builder.build(table5));
|
37958
|
+
} else if (is(builder, ForeignKeyBuilder3)) {
|
37959
|
+
foreignKeys.push(builder.build(table5));
|
37960
|
+
}
|
37961
|
+
}
|
37962
|
+
}
|
37963
|
+
return {
|
37964
|
+
columns,
|
37965
|
+
indexes,
|
37966
|
+
foreignKeys,
|
37967
|
+
checks,
|
37968
|
+
primaryKeys,
|
37969
|
+
uniqueConstraints,
|
37970
|
+
name: name2,
|
37971
|
+
schema: schema5,
|
37972
|
+
baseName
|
37973
|
+
};
|
37974
|
+
}
|
37975
|
+
function getViewConfig3(view4) {
|
37976
|
+
return {
|
37977
|
+
...view4[ViewBaseConfig],
|
37978
|
+
...view4[MySqlViewConfig]
|
37979
|
+
};
|
37980
|
+
}
|
37981
|
+
function convertIndexToString(indexes) {
|
37982
|
+
return indexes.map((idx) => {
|
37983
|
+
return typeof idx === "object" ? idx.config.name : idx;
|
37984
|
+
});
|
37985
|
+
}
|
37986
|
+
function toArray(value) {
|
37987
|
+
return Array.isArray(value) ? value : [value];
|
37988
|
+
}
|
37989
|
+
var init_utils8 = __esm({
|
37990
|
+
"../drizzle-orm/dist/mysql-core/utils.js"() {
|
37991
|
+
"use strict";
|
37992
|
+
init_entity();
|
37993
|
+
init_table();
|
37994
|
+
init_view_common();
|
37995
|
+
init_checks3();
|
37996
|
+
init_foreign_keys3();
|
37997
|
+
init_indexes3();
|
37998
|
+
init_primary_keys3();
|
37999
|
+
init_table4();
|
38000
|
+
init_unique_constraint3();
|
38001
|
+
init_view_common3();
|
38002
|
+
}
|
38003
|
+
});
|
38004
|
+
|
37812
38005
|
// ../drizzle-orm/dist/mysql-core/query-builders/select.js
|
37813
38006
|
function createSetOperator3(type, isAll) {
|
37814
38007
|
return (leftSelect, rightSelect, ...restSelects) => {
|
@@ -37827,11 +38020,12 @@ function createSetOperator3(type, isAll) {
|
|
37827
38020
|
return leftSelect.addSetOperators(setOperators);
|
37828
38021
|
};
|
37829
38022
|
}
|
37830
|
-
var
|
38023
|
+
var _a307, MySqlSelectBuilder, _a308, _b224, MySqlSelectQueryBuilderBase, _a309, _b225, MySqlSelectBase, getMySqlSetOperators, union3, unionAll3, intersect3, intersectAll2, except3, exceptAll2;
|
37831
38024
|
var init_select4 = __esm({
|
37832
38025
|
"../drizzle-orm/dist/mysql-core/query-builders/select.js"() {
|
37833
38026
|
"use strict";
|
37834
38027
|
init_entity();
|
38028
|
+
init_table4();
|
37835
38029
|
init_query_builder();
|
37836
38030
|
init_query_promise();
|
37837
38031
|
init_selection_proxy();
|
@@ -37839,10 +38033,10 @@ var init_select4 = __esm({
|
|
37839
38033
|
init_subquery();
|
37840
38034
|
init_table();
|
37841
38035
|
init_utils2();
|
37842
|
-
init_utils2();
|
37843
38036
|
init_view_common();
|
38037
|
+
init_utils8();
|
37844
38038
|
init_view_base3();
|
37845
|
-
|
38039
|
+
_a307 = entityKind;
|
37846
38040
|
MySqlSelectBuilder = class {
|
37847
38041
|
constructor(config) {
|
37848
38042
|
__publicField(this, "fields");
|
@@ -37858,7 +38052,7 @@ var init_select4 = __esm({
|
|
37858
38052
|
}
|
37859
38053
|
this.distinct = config.distinct;
|
37860
38054
|
}
|
37861
|
-
from(source) {
|
38055
|
+
from(source, onIndex) {
|
37862
38056
|
const isPartialSelect = !!this.fields;
|
37863
38057
|
let fields;
|
37864
38058
|
if (this.fields) {
|
@@ -37874,6 +38068,20 @@ var init_select4 = __esm({
|
|
37874
38068
|
} else {
|
37875
38069
|
fields = getTableColumns(source);
|
37876
38070
|
}
|
38071
|
+
let useIndex = [];
|
38072
|
+
let forceIndex = [];
|
38073
|
+
let ignoreIndex = [];
|
38074
|
+
if (is(source, MySqlTable) && onIndex && typeof onIndex !== "string") {
|
38075
|
+
if (onIndex.useIndex) {
|
38076
|
+
useIndex = convertIndexToString(toArray(onIndex.useIndex));
|
38077
|
+
}
|
38078
|
+
if (onIndex.forceIndex) {
|
38079
|
+
forceIndex = convertIndexToString(toArray(onIndex.forceIndex));
|
38080
|
+
}
|
38081
|
+
if (onIndex.ignoreIndex) {
|
38082
|
+
ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex));
|
38083
|
+
}
|
38084
|
+
}
|
37877
38085
|
return new MySqlSelectBase(
|
37878
38086
|
{
|
37879
38087
|
table: source,
|
@@ -37882,14 +38090,17 @@ var init_select4 = __esm({
|
|
37882
38090
|
session: this.session,
|
37883
38091
|
dialect: this.dialect,
|
37884
38092
|
withList: this.withList,
|
37885
|
-
distinct: this.distinct
|
38093
|
+
distinct: this.distinct,
|
38094
|
+
useIndex,
|
38095
|
+
forceIndex,
|
38096
|
+
ignoreIndex
|
37886
38097
|
}
|
37887
38098
|
);
|
37888
38099
|
}
|
37889
38100
|
};
|
37890
|
-
__publicField(MySqlSelectBuilder,
|
37891
|
-
MySqlSelectQueryBuilderBase = class extends (_b224 = TypedQueryBuilder,
|
37892
|
-
constructor({ table: table5, fields, isPartialSelect, session, dialect: dialect6, withList, distinct }) {
|
38101
|
+
__publicField(MySqlSelectBuilder, _a307, "MySqlSelectBuilder");
|
38102
|
+
MySqlSelectQueryBuilderBase = class extends (_b224 = TypedQueryBuilder, _a308 = entityKind, _b224) {
|
38103
|
+
constructor({ table: table5, fields, isPartialSelect, session, dialect: dialect6, withList, distinct, useIndex, forceIndex, ignoreIndex }) {
|
37893
38104
|
super();
|
37894
38105
|
__publicField(this, "_");
|
37895
38106
|
__publicField(this, "config");
|
@@ -37924,6 +38135,16 @@ var init_select4 = __esm({
|
|
37924
38135
|
* })
|
37925
38136
|
* .from(users)
|
37926
38137
|
* .leftJoin(pets, eq(users.id, pets.ownerId))
|
38138
|
+
*
|
38139
|
+
* // Select userId and petId with use index hint
|
38140
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
38141
|
+
* userId: users.id,
|
38142
|
+
* petId: pets.id,
|
38143
|
+
* })
|
38144
|
+
* .from(users)
|
38145
|
+
* .leftJoin(pets, eq(users.id, pets.ownerId), {
|
38146
|
+
* useIndex: ['pets_owner_id_index']
|
38147
|
+
* })
|
37927
38148
|
* ```
|
37928
38149
|
*/
|
37929
38150
|
__publicField(this, "leftJoin", this.createJoin("left"));
|
@@ -37952,6 +38173,16 @@ var init_select4 = __esm({
|
|
37952
38173
|
* })
|
37953
38174
|
* .from(users)
|
37954
38175
|
* .rightJoin(pets, eq(users.id, pets.ownerId))
|
38176
|
+
*
|
38177
|
+
* // Select userId and petId with use index hint
|
38178
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
38179
|
+
* userId: users.id,
|
38180
|
+
* petId: pets.id,
|
38181
|
+
* })
|
38182
|
+
* .from(users)
|
38183
|
+
* .leftJoin(pets, eq(users.id, pets.ownerId), {
|
38184
|
+
* useIndex: ['pets_owner_id_index']
|
38185
|
+
* })
|
37955
38186
|
* ```
|
37956
38187
|
*/
|
37957
38188
|
__publicField(this, "rightJoin", this.createJoin("right"));
|
@@ -37980,6 +38211,16 @@ var init_select4 = __esm({
|
|
37980
38211
|
* })
|
37981
38212
|
* .from(users)
|
37982
38213
|
* .innerJoin(pets, eq(users.id, pets.ownerId))
|
38214
|
+
*
|
38215
|
+
* // Select userId and petId with use index hint
|
38216
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
38217
|
+
* userId: users.id,
|
38218
|
+
* petId: pets.id,
|
38219
|
+
* })
|
38220
|
+
* .from(users)
|
38221
|
+
* .leftJoin(pets, eq(users.id, pets.ownerId), {
|
38222
|
+
* useIndex: ['pets_owner_id_index']
|
38223
|
+
* })
|
37983
38224
|
* ```
|
37984
38225
|
*/
|
37985
38226
|
__publicField(this, "innerJoin", this.createJoin("inner"));
|
@@ -38008,6 +38249,16 @@ var init_select4 = __esm({
|
|
38008
38249
|
* })
|
38009
38250
|
* .from(users)
|
38010
38251
|
* .fullJoin(pets, eq(users.id, pets.ownerId))
|
38252
|
+
*
|
38253
|
+
* // Select userId and petId with use index hint
|
38254
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
38255
|
+
* userId: users.id,
|
38256
|
+
* petId: pets.id,
|
38257
|
+
* })
|
38258
|
+
* .from(users)
|
38259
|
+
* .leftJoin(pets, eq(users.id, pets.ownerId), {
|
38260
|
+
* useIndex: ['pets_owner_id_index']
|
38261
|
+
* })
|
38011
38262
|
* ```
|
38012
38263
|
*/
|
38013
38264
|
__publicField(this, "fullJoin", this.createJoin("full"));
|
@@ -38202,7 +38453,10 @@ var init_select4 = __esm({
|
|
38202
38453
|
table: table5,
|
38203
38454
|
fields: { ...fields },
|
38204
38455
|
distinct,
|
38205
|
-
setOperators: []
|
38456
|
+
setOperators: [],
|
38457
|
+
useIndex,
|
38458
|
+
forceIndex,
|
38459
|
+
ignoreIndex
|
38206
38460
|
};
|
38207
38461
|
this.isPartialSelect = isPartialSelect;
|
38208
38462
|
this.session = session;
|
@@ -38214,7 +38468,7 @@ var init_select4 = __esm({
|
|
38214
38468
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
38215
38469
|
}
|
38216
38470
|
createJoin(joinType) {
|
38217
|
-
return (table5, on) => {
|
38471
|
+
return (table5, on, onIndex) => {
|
38218
38472
|
const baseTableName = this.tableName;
|
38219
38473
|
const tableName = getTableLikeName(table5);
|
38220
38474
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
@@ -38242,7 +38496,21 @@ var init_select4 = __esm({
|
|
38242
38496
|
if (!this.config.joins) {
|
38243
38497
|
this.config.joins = [];
|
38244
38498
|
}
|
38245
|
-
|
38499
|
+
let useIndex = [];
|
38500
|
+
let forceIndex = [];
|
38501
|
+
let ignoreIndex = [];
|
38502
|
+
if (is(table5, MySqlTable) && onIndex && typeof onIndex !== "string") {
|
38503
|
+
if (onIndex.useIndex) {
|
38504
|
+
useIndex = convertIndexToString(toArray(onIndex.useIndex));
|
38505
|
+
}
|
38506
|
+
if (onIndex.forceIndex) {
|
38507
|
+
forceIndex = convertIndexToString(toArray(onIndex.forceIndex));
|
38508
|
+
}
|
38509
|
+
if (onIndex.ignoreIndex) {
|
38510
|
+
ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex));
|
38511
|
+
}
|
38512
|
+
}
|
38513
|
+
this.config.joins.push({ on, table: table5, joinType, alias: tableName, useIndex, forceIndex, ignoreIndex });
|
38246
38514
|
if (typeof tableName === "string") {
|
38247
38515
|
switch (joinType) {
|
38248
38516
|
case "left": {
|
@@ -38489,8 +38757,8 @@ var init_select4 = __esm({
|
|
38489
38757
|
return this;
|
38490
38758
|
}
|
38491
38759
|
};
|
38492
|
-
__publicField(MySqlSelectQueryBuilderBase,
|
38493
|
-
MySqlSelectBase = class extends (_b225 = MySqlSelectQueryBuilderBase,
|
38760
|
+
__publicField(MySqlSelectQueryBuilderBase, _a308, "MySqlSelectQueryBuilder");
|
38761
|
+
MySqlSelectBase = class extends (_b225 = MySqlSelectQueryBuilderBase, _a309 = entityKind, _b225) {
|
38494
38762
|
constructor() {
|
38495
38763
|
super(...arguments);
|
38496
38764
|
__publicField(this, "execute", (placeholderValues) => {
|
@@ -38514,7 +38782,7 @@ var init_select4 = __esm({
|
|
38514
38782
|
return query;
|
38515
38783
|
}
|
38516
38784
|
};
|
38517
|
-
__publicField(MySqlSelectBase,
|
38785
|
+
__publicField(MySqlSelectBase, _a309, "MySqlSelect");
|
38518
38786
|
applyMixins(MySqlSelectBase, [QueryPromise]);
|
38519
38787
|
getMySqlSetOperators = () => ({
|
38520
38788
|
union: union3,
|
@@ -38534,7 +38802,7 @@ var init_select4 = __esm({
|
|
38534
38802
|
});
|
38535
38803
|
|
38536
38804
|
// ../drizzle-orm/dist/mysql-core/query-builders/query-builder.js
|
38537
|
-
var
|
38805
|
+
var _a310, QueryBuilder3;
|
38538
38806
|
var init_query_builder4 = __esm({
|
38539
38807
|
"../drizzle-orm/dist/mysql-core/query-builders/query-builder.js"() {
|
38540
38808
|
"use strict";
|
@@ -38543,7 +38811,7 @@ var init_query_builder4 = __esm({
|
|
38543
38811
|
init_selection_proxy();
|
38544
38812
|
init_subquery();
|
38545
38813
|
init_select4();
|
38546
|
-
|
38814
|
+
_a310 = entityKind;
|
38547
38815
|
QueryBuilder3 = class {
|
38548
38816
|
constructor(dialect6) {
|
38549
38817
|
__publicField(this, "dialect");
|
@@ -38605,12 +38873,12 @@ var init_query_builder4 = __esm({
|
|
38605
38873
|
return this.dialect;
|
38606
38874
|
}
|
38607
38875
|
};
|
38608
|
-
__publicField(QueryBuilder3,
|
38876
|
+
__publicField(QueryBuilder3, _a310, "MySqlQueryBuilder");
|
38609
38877
|
}
|
38610
38878
|
});
|
38611
38879
|
|
38612
38880
|
// ../drizzle-orm/dist/mysql-core/query-builders/insert.js
|
38613
|
-
var
|
38881
|
+
var _a311, MySqlInsertBuilder, _a312, _b226, MySqlInsertBase;
|
38614
38882
|
var init_insert3 = __esm({
|
38615
38883
|
"../drizzle-orm/dist/mysql-core/query-builders/insert.js"() {
|
38616
38884
|
"use strict";
|
@@ -38620,7 +38888,7 @@ var init_insert3 = __esm({
|
|
38620
38888
|
init_table();
|
38621
38889
|
init_utils2();
|
38622
38890
|
init_query_builder4();
|
38623
|
-
|
38891
|
+
_a311 = entityKind;
|
38624
38892
|
MySqlInsertBuilder = class {
|
38625
38893
|
constructor(table5, session, dialect6) {
|
38626
38894
|
__publicField(this, "shouldIgnore", false);
|
@@ -38658,8 +38926,8 @@ var init_insert3 = __esm({
|
|
38658
38926
|
return new MySqlInsertBase(this.table, select, this.shouldIgnore, this.session, this.dialect, true);
|
38659
38927
|
}
|
38660
38928
|
};
|
38661
|
-
__publicField(MySqlInsertBuilder,
|
38662
|
-
MySqlInsertBase = class extends (_b226 = QueryPromise,
|
38929
|
+
__publicField(MySqlInsertBuilder, _a311, "MySqlInsertBuilder");
|
38930
|
+
MySqlInsertBase = class extends (_b226 = QueryPromise, _a312 = entityKind, _b226) {
|
38663
38931
|
constructor(table5, values, ignore, session, dialect6, select) {
|
38664
38932
|
super();
|
38665
38933
|
__publicField(this, "config");
|
@@ -38740,7 +39008,7 @@ var init_insert3 = __esm({
|
|
38740
39008
|
return this;
|
38741
39009
|
}
|
38742
39010
|
};
|
38743
|
-
__publicField(MySqlInsertBase,
|
39011
|
+
__publicField(MySqlInsertBase, _a312, "MySqlInsert");
|
38744
39012
|
}
|
38745
39013
|
});
|
38746
39014
|
|
@@ -38752,7 +39020,7 @@ var init_select_types3 = __esm({
|
|
38752
39020
|
});
|
38753
39021
|
|
38754
39022
|
// ../drizzle-orm/dist/mysql-core/query-builders/update.js
|
38755
|
-
var
|
39023
|
+
var _a313, MySqlUpdateBuilder, _a314, _b227, MySqlUpdateBase;
|
38756
39024
|
var init_update3 = __esm({
|
38757
39025
|
"../drizzle-orm/dist/mysql-core/query-builders/update.js"() {
|
38758
39026
|
"use strict";
|
@@ -38761,7 +39029,7 @@ var init_update3 = __esm({
|
|
38761
39029
|
init_selection_proxy();
|
38762
39030
|
init_table();
|
38763
39031
|
init_utils2();
|
38764
|
-
|
39032
|
+
_a313 = entityKind;
|
38765
39033
|
MySqlUpdateBuilder = class {
|
38766
39034
|
constructor(table5, session, dialect6, withList) {
|
38767
39035
|
this.table = table5;
|
@@ -38773,8 +39041,8 @@ var init_update3 = __esm({
|
|
38773
39041
|
return new MySqlUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
|
38774
39042
|
}
|
38775
39043
|
};
|
38776
|
-
__publicField(MySqlUpdateBuilder,
|
38777
|
-
MySqlUpdateBase = class extends (_b227 = QueryPromise,
|
39044
|
+
__publicField(MySqlUpdateBuilder, _a313, "MySqlUpdateBuilder");
|
39045
|
+
MySqlUpdateBase = class extends (_b227 = QueryPromise, _a314 = entityKind, _b227) {
|
38778
39046
|
constructor(table5, set, session, dialect6, withList) {
|
38779
39047
|
super();
|
38780
39048
|
__publicField(this, "config");
|
@@ -38867,7 +39135,7 @@ var init_update3 = __esm({
|
|
38867
39135
|
return this;
|
38868
39136
|
}
|
38869
39137
|
};
|
38870
|
-
__publicField(MySqlUpdateBase,
|
39138
|
+
__publicField(MySqlUpdateBase, _a314, "MySqlUpdate");
|
38871
39139
|
}
|
38872
39140
|
});
|
38873
39141
|
|
@@ -38885,14 +39153,14 @@ var init_query_builders3 = __esm({
|
|
38885
39153
|
});
|
38886
39154
|
|
38887
39155
|
// ../drizzle-orm/dist/mysql-core/query-builders/query.js
|
38888
|
-
var
|
39156
|
+
var _a315, RelationalQueryBuilder3, _a316, _b228, MySqlRelationalQuery;
|
38889
39157
|
var init_query3 = __esm({
|
38890
39158
|
"../drizzle-orm/dist/mysql-core/query-builders/query.js"() {
|
38891
39159
|
"use strict";
|
38892
39160
|
init_entity();
|
38893
39161
|
init_query_promise();
|
38894
39162
|
init_relations();
|
38895
|
-
|
39163
|
+
_a315 = entityKind;
|
38896
39164
|
RelationalQueryBuilder3 = class {
|
38897
39165
|
constructor(fullSchema, schema5, tableNamesMap, table5, tableConfig, dialect6, session, mode) {
|
38898
39166
|
this.fullSchema = fullSchema;
|
@@ -38933,8 +39201,8 @@ var init_query3 = __esm({
|
|
38933
39201
|
);
|
38934
39202
|
}
|
38935
39203
|
};
|
38936
|
-
__publicField(RelationalQueryBuilder3,
|
38937
|
-
MySqlRelationalQuery = class extends (_b228 = QueryPromise,
|
39204
|
+
__publicField(RelationalQueryBuilder3, _a315, "MySqlRelationalQueryBuilder");
|
39205
|
+
MySqlRelationalQuery = class extends (_b228 = QueryPromise, _a316 = entityKind, _b228) {
|
38938
39206
|
constructor(fullSchema, schema5, tableNamesMap, table5, tableConfig, dialect6, session, config, queryMode, mode) {
|
38939
39207
|
super();
|
38940
39208
|
this.fullSchema = fullSchema;
|
@@ -38998,12 +39266,12 @@ var init_query3 = __esm({
|
|
38998
39266
|
return this.prepare().execute();
|
38999
39267
|
}
|
39000
39268
|
};
|
39001
|
-
__publicField(MySqlRelationalQuery,
|
39269
|
+
__publicField(MySqlRelationalQuery, _a316, "MySqlRelationalQuery");
|
39002
39270
|
}
|
39003
39271
|
});
|
39004
39272
|
|
39005
39273
|
// ../drizzle-orm/dist/mysql-core/db.js
|
39006
|
-
var
|
39274
|
+
var _a317, MySqlDatabase;
|
39007
39275
|
var init_db3 = __esm({
|
39008
39276
|
"../drizzle-orm/dist/mysql-core/db.js"() {
|
39009
39277
|
"use strict";
|
@@ -39014,7 +39282,7 @@ var init_db3 = __esm({
|
|
39014
39282
|
init_count3();
|
39015
39283
|
init_query_builders3();
|
39016
39284
|
init_query3();
|
39017
|
-
|
39285
|
+
_a317 = entityKind;
|
39018
39286
|
MySqlDatabase = class {
|
39019
39287
|
constructor(dialect6, session, schema5, mode) {
|
39020
39288
|
__publicField(this, "query");
|
@@ -39227,113 +39495,7 @@ var init_db3 = __esm({
|
|
39227
39495
|
return this.session.transaction(transaction, config);
|
39228
39496
|
}
|
39229
39497
|
};
|
39230
|
-
__publicField(MySqlDatabase,
|
39231
|
-
}
|
39232
|
-
});
|
39233
|
-
|
39234
|
-
// ../drizzle-orm/dist/mysql-core/indexes.js
|
39235
|
-
var _a313, IndexBuilderOn3, _a314, IndexBuilder3, _a315, Index5;
|
39236
|
-
var init_indexes3 = __esm({
|
39237
|
-
"../drizzle-orm/dist/mysql-core/indexes.js"() {
|
39238
|
-
"use strict";
|
39239
|
-
init_entity();
|
39240
|
-
_a313 = entityKind;
|
39241
|
-
IndexBuilderOn3 = class {
|
39242
|
-
constructor(name2, unique) {
|
39243
|
-
this.name = name2;
|
39244
|
-
this.unique = unique;
|
39245
|
-
}
|
39246
|
-
on(...columns) {
|
39247
|
-
return new IndexBuilder3(this.name, columns, this.unique);
|
39248
|
-
}
|
39249
|
-
};
|
39250
|
-
__publicField(IndexBuilderOn3, _a313, "MySqlIndexBuilderOn");
|
39251
|
-
_a314 = entityKind;
|
39252
|
-
IndexBuilder3 = class {
|
39253
|
-
constructor(name2, columns, unique) {
|
39254
|
-
/** @internal */
|
39255
|
-
__publicField(this, "config");
|
39256
|
-
this.config = {
|
39257
|
-
name: name2,
|
39258
|
-
columns,
|
39259
|
-
unique
|
39260
|
-
};
|
39261
|
-
}
|
39262
|
-
using(using) {
|
39263
|
-
this.config.using = using;
|
39264
|
-
return this;
|
39265
|
-
}
|
39266
|
-
algorythm(algorythm) {
|
39267
|
-
this.config.algorythm = algorythm;
|
39268
|
-
return this;
|
39269
|
-
}
|
39270
|
-
lock(lock) {
|
39271
|
-
this.config.lock = lock;
|
39272
|
-
return this;
|
39273
|
-
}
|
39274
|
-
/** @internal */
|
39275
|
-
build(table5) {
|
39276
|
-
return new Index5(this.config, table5);
|
39277
|
-
}
|
39278
|
-
};
|
39279
|
-
__publicField(IndexBuilder3, _a314, "MySqlIndexBuilder");
|
39280
|
-
_a315 = entityKind;
|
39281
|
-
Index5 = class {
|
39282
|
-
constructor(config, table5) {
|
39283
|
-
__publicField(this, "config");
|
39284
|
-
this.config = { ...config, table: table5 };
|
39285
|
-
}
|
39286
|
-
};
|
39287
|
-
__publicField(Index5, _a315, "MySqlIndex");
|
39288
|
-
}
|
39289
|
-
});
|
39290
|
-
|
39291
|
-
// ../drizzle-orm/dist/mysql-core/primary-keys.js
|
39292
|
-
var _a316, PrimaryKeyBuilder3, _a317, PrimaryKey3;
|
39293
|
-
var init_primary_keys3 = __esm({
|
39294
|
-
"../drizzle-orm/dist/mysql-core/primary-keys.js"() {
|
39295
|
-
"use strict";
|
39296
|
-
init_entity();
|
39297
|
-
init_table4();
|
39298
|
-
_a316 = entityKind;
|
39299
|
-
PrimaryKeyBuilder3 = class {
|
39300
|
-
constructor(columns, name2) {
|
39301
|
-
/** @internal */
|
39302
|
-
__publicField(this, "columns");
|
39303
|
-
/** @internal */
|
39304
|
-
__publicField(this, "name");
|
39305
|
-
this.columns = columns;
|
39306
|
-
this.name = name2;
|
39307
|
-
}
|
39308
|
-
/** @internal */
|
39309
|
-
build(table5) {
|
39310
|
-
return new PrimaryKey3(table5, this.columns, this.name);
|
39311
|
-
}
|
39312
|
-
};
|
39313
|
-
__publicField(PrimaryKeyBuilder3, _a316, "MySqlPrimaryKeyBuilder");
|
39314
|
-
_a317 = entityKind;
|
39315
|
-
PrimaryKey3 = class {
|
39316
|
-
constructor(table5, columns, name2) {
|
39317
|
-
__publicField(this, "columns");
|
39318
|
-
__publicField(this, "name");
|
39319
|
-
this.table = table5;
|
39320
|
-
this.columns = columns;
|
39321
|
-
this.name = name2;
|
39322
|
-
}
|
39323
|
-
getName() {
|
39324
|
-
return this.name ?? `${this.table[MySqlTable.Symbol.Name]}_${this.columns.map((column5) => column5.name).join("_")}_pk`;
|
39325
|
-
}
|
39326
|
-
};
|
39327
|
-
__publicField(PrimaryKey3, _a317, "MySqlPrimaryKey");
|
39328
|
-
}
|
39329
|
-
});
|
39330
|
-
|
39331
|
-
// ../drizzle-orm/dist/mysql-core/view-common.js
|
39332
|
-
var MySqlViewConfig;
|
39333
|
-
var init_view_common3 = __esm({
|
39334
|
-
"../drizzle-orm/dist/mysql-core/view-common.js"() {
|
39335
|
-
"use strict";
|
39336
|
-
MySqlViewConfig = Symbol.for("drizzle:MySqlViewConfig");
|
39498
|
+
__publicField(MySqlDatabase, _a317, "MySqlDatabase");
|
39337
39499
|
}
|
39338
39500
|
});
|
39339
39501
|
|
@@ -39558,69 +39720,6 @@ var init_subquery4 = __esm({
|
|
39558
39720
|
}
|
39559
39721
|
});
|
39560
39722
|
|
39561
|
-
// ../drizzle-orm/dist/mysql-core/utils.js
|
39562
|
-
function getTableConfig3(table5) {
|
39563
|
-
const columns = Object.values(table5[MySqlTable.Symbol.Columns]);
|
39564
|
-
const indexes = [];
|
39565
|
-
const checks = [];
|
39566
|
-
const primaryKeys = [];
|
39567
|
-
const uniqueConstraints = [];
|
39568
|
-
const foreignKeys = Object.values(table5[MySqlTable.Symbol.InlineForeignKeys]);
|
39569
|
-
const name2 = table5[Table2.Symbol.Name];
|
39570
|
-
const schema5 = table5[Table2.Symbol.Schema];
|
39571
|
-
const baseName = table5[Table2.Symbol.BaseName];
|
39572
|
-
const extraConfigBuilder = table5[MySqlTable.Symbol.ExtraConfigBuilder];
|
39573
|
-
if (extraConfigBuilder !== void 0) {
|
39574
|
-
const extraConfig = extraConfigBuilder(table5[MySqlTable.Symbol.Columns]);
|
39575
|
-
const extraValues = Array.isArray(extraConfig) ? extraConfig.flat(1) : Object.values(extraConfig);
|
39576
|
-
for (const builder of Object.values(extraValues)) {
|
39577
|
-
if (is(builder, IndexBuilder3)) {
|
39578
|
-
indexes.push(builder.build(table5));
|
39579
|
-
} else if (is(builder, CheckBuilder3)) {
|
39580
|
-
checks.push(builder.build(table5));
|
39581
|
-
} else if (is(builder, UniqueConstraintBuilder3)) {
|
39582
|
-
uniqueConstraints.push(builder.build(table5));
|
39583
|
-
} else if (is(builder, PrimaryKeyBuilder3)) {
|
39584
|
-
primaryKeys.push(builder.build(table5));
|
39585
|
-
} else if (is(builder, ForeignKeyBuilder3)) {
|
39586
|
-
foreignKeys.push(builder.build(table5));
|
39587
|
-
}
|
39588
|
-
}
|
39589
|
-
}
|
39590
|
-
return {
|
39591
|
-
columns,
|
39592
|
-
indexes,
|
39593
|
-
foreignKeys,
|
39594
|
-
checks,
|
39595
|
-
primaryKeys,
|
39596
|
-
uniqueConstraints,
|
39597
|
-
name: name2,
|
39598
|
-
schema: schema5,
|
39599
|
-
baseName
|
39600
|
-
};
|
39601
|
-
}
|
39602
|
-
function getViewConfig3(view4) {
|
39603
|
-
return {
|
39604
|
-
...view4[ViewBaseConfig],
|
39605
|
-
...view4[MySqlViewConfig]
|
39606
|
-
};
|
39607
|
-
}
|
39608
|
-
var init_utils8 = __esm({
|
39609
|
-
"../drizzle-orm/dist/mysql-core/utils.js"() {
|
39610
|
-
"use strict";
|
39611
|
-
init_entity();
|
39612
|
-
init_table();
|
39613
|
-
init_view_common();
|
39614
|
-
init_checks3();
|
39615
|
-
init_foreign_keys3();
|
39616
|
-
init_indexes3();
|
39617
|
-
init_primary_keys3();
|
39618
|
-
init_table4();
|
39619
|
-
init_unique_constraint3();
|
39620
|
-
init_view_common3();
|
39621
|
-
}
|
39622
|
-
});
|
39623
|
-
|
39624
39723
|
// ../drizzle-orm/dist/mysql-core/index.js
|
39625
39724
|
var init_mysql_core = __esm({
|
39626
39725
|
"../drizzle-orm/dist/mysql-core/index.js"() {
|