drizzle-kit 0.31.7 → 0.31.8-5c8a4c5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.js +80 -19
- package/api.mjs +80 -19
- package/bin.cjs +3 -3
- package/package.json +1 -1
package/api.js
CHANGED
|
@@ -828,7 +828,7 @@ var version;
|
|
|
828
828
|
var init_version = __esm({
|
|
829
829
|
"../drizzle-orm/dist/version.js"() {
|
|
830
830
|
"use strict";
|
|
831
|
-
version = "0.
|
|
831
|
+
version = "0.45.0";
|
|
832
832
|
}
|
|
833
833
|
});
|
|
834
834
|
|
|
@@ -1628,6 +1628,8 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
|
1628
1628
|
decoder2 = field;
|
|
1629
1629
|
} else if (is(field, SQL)) {
|
|
1630
1630
|
decoder2 = field.decoder;
|
|
1631
|
+
} else if (is(field, Subquery)) {
|
|
1632
|
+
decoder2 = field._.sql.decoder;
|
|
1631
1633
|
} else {
|
|
1632
1634
|
decoder2 = field.sql.decoder;
|
|
1633
1635
|
}
|
|
@@ -1670,7 +1672,7 @@ function orderSelectedFields(fields, pathPrefix) {
|
|
|
1670
1672
|
return result;
|
|
1671
1673
|
}
|
|
1672
1674
|
const newPath = pathPrefix ? [...pathPrefix, name3] : [name3];
|
|
1673
|
-
if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased)) {
|
|
1675
|
+
if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased) || is(field, Subquery)) {
|
|
1674
1676
|
result.push({ path: newPath, field });
|
|
1675
1677
|
} else if (is(field, Table)) {
|
|
1676
1678
|
result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
|
|
@@ -2162,7 +2164,8 @@ var init_date = __esm({
|
|
|
2162
2164
|
return "date";
|
|
2163
2165
|
}
|
|
2164
2166
|
mapFromDriverValue(value) {
|
|
2165
|
-
return new Date(value);
|
|
2167
|
+
if (typeof value === "string") return new Date(value);
|
|
2168
|
+
return value;
|
|
2166
2169
|
}
|
|
2167
2170
|
mapToDriverValue(value) {
|
|
2168
2171
|
return value.toISOString();
|
|
@@ -2186,6 +2189,10 @@ var init_date = __esm({
|
|
|
2186
2189
|
getSQLType() {
|
|
2187
2190
|
return "date";
|
|
2188
2191
|
}
|
|
2192
|
+
mapFromDriverValue(value) {
|
|
2193
|
+
if (typeof value === "string") return value;
|
|
2194
|
+
return value.toISOString().slice(0, -14);
|
|
2195
|
+
}
|
|
2189
2196
|
};
|
|
2190
2197
|
__publicField(PgDateString, _a58, "PgDateString");
|
|
2191
2198
|
}
|
|
@@ -3124,9 +3131,6 @@ var init_timestamp = __esm({
|
|
|
3124
3131
|
super(table6, config);
|
|
3125
3132
|
__publicField(this, "withTimezone");
|
|
3126
3133
|
__publicField(this, "precision");
|
|
3127
|
-
__publicField(this, "mapFromDriverValue", (value) => {
|
|
3128
|
-
return new Date(this.withTimezone ? value : value + "+0000");
|
|
3129
|
-
});
|
|
3130
3134
|
__publicField(this, "mapToDriverValue", (value) => {
|
|
3131
3135
|
return value.toISOString();
|
|
3132
3136
|
});
|
|
@@ -3137,6 +3141,10 @@ var init_timestamp = __esm({
|
|
|
3137
3141
|
const precision = this.precision === void 0 ? "" : ` (${this.precision})`;
|
|
3138
3142
|
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
3139
3143
|
}
|
|
3144
|
+
mapFromDriverValue(value) {
|
|
3145
|
+
if (typeof value === "string") return new Date(this.withTimezone ? value : value + "+0000");
|
|
3146
|
+
return value;
|
|
3147
|
+
}
|
|
3140
3148
|
};
|
|
3141
3149
|
__publicField(PgTimestamp, _a106, "PgTimestamp");
|
|
3142
3150
|
PgTimestampStringBuilder = class extends (_b86 = PgDateColumnBaseBuilder, _a107 = entityKind, _b86) {
|
|
@@ -3166,6 +3174,16 @@ var init_timestamp = __esm({
|
|
|
3166
3174
|
const precision = this.precision === void 0 ? "" : `(${this.precision})`;
|
|
3167
3175
|
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
3168
3176
|
}
|
|
3177
|
+
mapFromDriverValue(value) {
|
|
3178
|
+
if (typeof value === "string") return value;
|
|
3179
|
+
const shortened = value.toISOString().slice(0, -1).replace("T", " ");
|
|
3180
|
+
if (this.withTimezone) {
|
|
3181
|
+
const offset = value.getTimezoneOffset();
|
|
3182
|
+
const sign = offset <= 0 ? "+" : "-";
|
|
3183
|
+
return `${shortened}${sign}${Math.floor(Math.abs(offset) / 60).toString().padStart(2, "0")}`;
|
|
3184
|
+
}
|
|
3185
|
+
return shortened;
|
|
3186
|
+
}
|
|
3169
3187
|
};
|
|
3170
3188
|
__publicField(PgTimestampString, _a108, "PgTimestampString");
|
|
3171
3189
|
}
|
|
@@ -6041,8 +6059,8 @@ var init_indexes = __esm({
|
|
|
6041
6059
|
this.config.using = using;
|
|
6042
6060
|
return this;
|
|
6043
6061
|
}
|
|
6044
|
-
|
|
6045
|
-
this.config.
|
|
6062
|
+
algorithm(algorithm) {
|
|
6063
|
+
this.config.algorithm = algorithm;
|
|
6046
6064
|
return this;
|
|
6047
6065
|
}
|
|
6048
6066
|
lock(lock) {
|
|
@@ -6589,7 +6607,8 @@ var init_dialect = __esm({
|
|
|
6589
6607
|
const setSize = columnNames.length;
|
|
6590
6608
|
return sql.join(columnNames.flatMap((colName, i8) => {
|
|
6591
6609
|
const col = tableColumns[colName];
|
|
6592
|
-
const
|
|
6610
|
+
const onUpdateFnResult = col.onUpdateFn?.();
|
|
6611
|
+
const value = set[colName] ?? (is(onUpdateFnResult, SQL) ? onUpdateFnResult : sql.param(onUpdateFnResult, col));
|
|
6593
6612
|
const res = sql`${sql.identifier(this.casing.getColumnCasing(col))} = ${value}`;
|
|
6594
6613
|
if (i8 < setSize - 1) {
|
|
6595
6614
|
return [res, sql.raw(", ")];
|
|
@@ -6648,6 +6667,16 @@ var init_dialect = __esm({
|
|
|
6648
6667
|
} else {
|
|
6649
6668
|
chunk.push(field);
|
|
6650
6669
|
}
|
|
6670
|
+
} else if (is(field, Subquery)) {
|
|
6671
|
+
const entries = Object.entries(field._.selectedFields);
|
|
6672
|
+
if (entries.length === 1) {
|
|
6673
|
+
const entry = entries[0][1];
|
|
6674
|
+
const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
|
|
6675
|
+
if (fieldDecoder) {
|
|
6676
|
+
field._.sql.decoder = fieldDecoder;
|
|
6677
|
+
}
|
|
6678
|
+
}
|
|
6679
|
+
chunk.push(field);
|
|
6651
6680
|
}
|
|
6652
6681
|
if (i8 < columnsLen - 1) {
|
|
6653
6682
|
chunk.push(sql`, `);
|
|
@@ -9654,7 +9683,8 @@ var init_dialect2 = __esm({
|
|
|
9654
9683
|
const setSize = columnNames.length;
|
|
9655
9684
|
return sql.join(columnNames.flatMap((colName, i8) => {
|
|
9656
9685
|
const col = tableColumns[colName];
|
|
9657
|
-
const
|
|
9686
|
+
const onUpdateFnResult = col.onUpdateFn?.();
|
|
9687
|
+
const value = set[colName] ?? (is(onUpdateFnResult, SQL) ? onUpdateFnResult : sql.param(onUpdateFnResult, col));
|
|
9658
9688
|
const res = sql`${sql.identifier(this.casing.getColumnCasing(col))} = ${value}`;
|
|
9659
9689
|
if (i8 < setSize - 1) {
|
|
9660
9690
|
return [res, sql.raw(", ")];
|
|
@@ -9718,6 +9748,16 @@ var init_dialect2 = __esm({
|
|
|
9718
9748
|
} else {
|
|
9719
9749
|
chunk.push(field);
|
|
9720
9750
|
}
|
|
9751
|
+
} else if (is(field, Subquery)) {
|
|
9752
|
+
const entries = Object.entries(field._.selectedFields);
|
|
9753
|
+
if (entries.length === 1) {
|
|
9754
|
+
const entry = entries[0][1];
|
|
9755
|
+
const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
|
|
9756
|
+
if (fieldDecoder) {
|
|
9757
|
+
field._.sql.decoder = fieldDecoder;
|
|
9758
|
+
}
|
|
9759
|
+
}
|
|
9760
|
+
chunk.push(field);
|
|
9721
9761
|
}
|
|
9722
9762
|
if (i8 < columnsLen - 1) {
|
|
9723
9763
|
chunk.push(sql`, `);
|
|
@@ -15262,8 +15302,8 @@ var init_indexes3 = __esm({
|
|
|
15262
15302
|
this.config.using = using;
|
|
15263
15303
|
return this;
|
|
15264
15304
|
}
|
|
15265
|
-
|
|
15266
|
-
this.config.
|
|
15305
|
+
algorithm(algorithm) {
|
|
15306
|
+
this.config.algorithm = algorithm;
|
|
15267
15307
|
return this;
|
|
15268
15308
|
}
|
|
15269
15309
|
lock(lock) {
|
|
@@ -15823,7 +15863,8 @@ var init_dialect3 = __esm({
|
|
|
15823
15863
|
const setSize = columnNames.length;
|
|
15824
15864
|
return sql.join(columnNames.flatMap((colName, i8) => {
|
|
15825
15865
|
const col = tableColumns[colName];
|
|
15826
|
-
const
|
|
15866
|
+
const onUpdateFnResult = col.onUpdateFn?.();
|
|
15867
|
+
const value = set[colName] ?? (is(onUpdateFnResult, SQL) ? onUpdateFnResult : sql.param(onUpdateFnResult, col));
|
|
15827
15868
|
const res = sql`${sql.identifier(this.casing.getColumnCasing(col))} = ${value}`;
|
|
15828
15869
|
if (i8 < setSize - 1) {
|
|
15829
15870
|
return [res, sql.raw(", ")];
|
|
@@ -15882,6 +15923,16 @@ var init_dialect3 = __esm({
|
|
|
15882
15923
|
} else {
|
|
15883
15924
|
chunk.push(field);
|
|
15884
15925
|
}
|
|
15926
|
+
} else if (is(field, Subquery)) {
|
|
15927
|
+
const entries = Object.entries(field._.selectedFields);
|
|
15928
|
+
if (entries.length === 1) {
|
|
15929
|
+
const entry = entries[0][1];
|
|
15930
|
+
const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
|
|
15931
|
+
if (fieldDecoder) {
|
|
15932
|
+
field._.sql.decoder = fieldDecoder;
|
|
15933
|
+
}
|
|
15934
|
+
}
|
|
15935
|
+
chunk.push(field);
|
|
15885
15936
|
}
|
|
15886
15937
|
if (i8 < columnsLen - 1) {
|
|
15887
15938
|
chunk.push(sql`, `);
|
|
@@ -18872,7 +18923,8 @@ var init_dialect4 = __esm({
|
|
|
18872
18923
|
const setSize = columnNames.length;
|
|
18873
18924
|
return sql.join(columnNames.flatMap((colName, i8) => {
|
|
18874
18925
|
const col = tableColumns[colName];
|
|
18875
|
-
const
|
|
18926
|
+
const onUpdateFnResult = col.onUpdateFn?.();
|
|
18927
|
+
const value = set[colName] ?? (is(onUpdateFnResult, SQL) ? onUpdateFnResult : sql.param(onUpdateFnResult, col));
|
|
18876
18928
|
const res = sql`${sql.identifier(this.casing.getColumnCasing(col))} = ${value}`;
|
|
18877
18929
|
if (i8 < setSize - 1) {
|
|
18878
18930
|
return [res, sql.raw(", ")];
|
|
@@ -18944,6 +18996,14 @@ var init_dialect4 = __esm({
|
|
|
18944
18996
|
chunk.push(sql`${sql.identifier(tableName)}.${sql.identifier(this.casing.getColumnCasing(field))}`);
|
|
18945
18997
|
}
|
|
18946
18998
|
}
|
|
18999
|
+
} else if (is(field, Subquery)) {
|
|
19000
|
+
const entries = Object.entries(field._.selectedFields);
|
|
19001
|
+
if (entries.length === 1) {
|
|
19002
|
+
const entry = entries[0][1];
|
|
19003
|
+
const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
|
|
19004
|
+
if (fieldDecoder) field._.sql.decoder = fieldDecoder;
|
|
19005
|
+
}
|
|
19006
|
+
chunk.push(field);
|
|
18947
19007
|
}
|
|
18948
19008
|
if (i8 < columnsLen - 1) {
|
|
18949
19009
|
chunk.push(sql`, `);
|
|
@@ -46310,7 +46370,7 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
|
46310
46370
|
columns: indexColumns,
|
|
46311
46371
|
isUnique: value.config.unique ?? false,
|
|
46312
46372
|
using: value.config.using,
|
|
46313
|
-
algorithm: value.config.
|
|
46373
|
+
algorithm: value.config.algorithm,
|
|
46314
46374
|
lock: value.config.lock
|
|
46315
46375
|
};
|
|
46316
46376
|
});
|
|
@@ -47441,7 +47501,7 @@ The unique index ${source_default.underline.blue(
|
|
|
47441
47501
|
columns: indexColumns,
|
|
47442
47502
|
isUnique: value.config.unique ?? false,
|
|
47443
47503
|
using: value.config.using,
|
|
47444
|
-
algorithm: value.config.
|
|
47504
|
+
algorithm: value.config.algorithm,
|
|
47445
47505
|
lock: value.config.lock
|
|
47446
47506
|
};
|
|
47447
47507
|
});
|
|
@@ -97809,7 +97869,7 @@ var init_core = __esm({
|
|
|
97809
97869
|
});
|
|
97810
97870
|
|
|
97811
97871
|
// ../drizzle-orm/dist/node-postgres/session.js
|
|
97812
|
-
var Pool2, types4, _a461, _b335, NodePgPreparedQuery, _a462, _b336, _NodePgSession, NodePgSession, _a463, _b337, _NodePgTransaction, NodePgTransaction;
|
|
97872
|
+
var Pool2, types4, NativePool, _a461, _b335, NodePgPreparedQuery, _a462, _b336, _NodePgSession, NodePgSession, _a463, _b337, _NodePgTransaction, NodePgTransaction;
|
|
97813
97873
|
var init_session7 = __esm({
|
|
97814
97874
|
"../drizzle-orm/dist/node-postgres/session.js"() {
|
|
97815
97875
|
"use strict";
|
|
@@ -97823,6 +97883,7 @@ var init_session7 = __esm({
|
|
|
97823
97883
|
init_tracing();
|
|
97824
97884
|
init_utils();
|
|
97825
97885
|
({ Pool: Pool2, types: types4 } = esm_default);
|
|
97886
|
+
NativePool = esm_default.native ? esm_default.native.Pool : void 0;
|
|
97826
97887
|
NodePgPreparedQuery = class extends (_b335 = PgPreparedQuery, _a461 = entityKind, _b335) {
|
|
97827
97888
|
constructor(client, queryString, params, logger2, cache5, queryMetadata, cacheConfig, fields, name3, _isResponseInArrayMode, customResultMapper) {
|
|
97828
97889
|
super({ sql: queryString, params }, cache5, queryMetadata, cacheConfig);
|
|
@@ -97992,7 +98053,7 @@ var init_session7 = __esm({
|
|
|
97992
98053
|
);
|
|
97993
98054
|
}
|
|
97994
98055
|
async transaction(transaction, config) {
|
|
97995
|
-
const session = this.client instanceof Pool2 ? new _NodePgSession(await this.client.connect(), this.dialect, this.schema, this.options) : this;
|
|
98056
|
+
const session = this.client instanceof Pool2 || NativePool && this.client instanceof NativePool ? new _NodePgSession(await this.client.connect(), this.dialect, this.schema, this.options) : this;
|
|
97996
98057
|
const tx = new NodePgTransaction(this.dialect, session, this.schema);
|
|
97997
98058
|
await tx.execute(sql`begin${config ? sql` ${tx.getTransactionConfigSQL(config)}` : void 0}`);
|
|
97998
98059
|
try {
|
|
@@ -98003,7 +98064,7 @@ var init_session7 = __esm({
|
|
|
98003
98064
|
await tx.execute(sql`rollback`);
|
|
98004
98065
|
throw error2;
|
|
98005
98066
|
} finally {
|
|
98006
|
-
if (this.client instanceof Pool2) {
|
|
98067
|
+
if (this.client instanceof Pool2 || NativePool && this.client instanceof NativePool) {
|
|
98007
98068
|
session.client.release();
|
|
98008
98069
|
}
|
|
98009
98070
|
}
|
package/api.mjs
CHANGED
|
@@ -834,7 +834,7 @@ var version;
|
|
|
834
834
|
var init_version = __esm({
|
|
835
835
|
"../drizzle-orm/dist/version.js"() {
|
|
836
836
|
"use strict";
|
|
837
|
-
version = "0.
|
|
837
|
+
version = "0.45.0";
|
|
838
838
|
}
|
|
839
839
|
});
|
|
840
840
|
|
|
@@ -1634,6 +1634,8 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
|
1634
1634
|
decoder2 = field;
|
|
1635
1635
|
} else if (is(field, SQL)) {
|
|
1636
1636
|
decoder2 = field.decoder;
|
|
1637
|
+
} else if (is(field, Subquery)) {
|
|
1638
|
+
decoder2 = field._.sql.decoder;
|
|
1637
1639
|
} else {
|
|
1638
1640
|
decoder2 = field.sql.decoder;
|
|
1639
1641
|
}
|
|
@@ -1676,7 +1678,7 @@ function orderSelectedFields(fields, pathPrefix) {
|
|
|
1676
1678
|
return result;
|
|
1677
1679
|
}
|
|
1678
1680
|
const newPath = pathPrefix ? [...pathPrefix, name3] : [name3];
|
|
1679
|
-
if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased)) {
|
|
1681
|
+
if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased) || is(field, Subquery)) {
|
|
1680
1682
|
result.push({ path: newPath, field });
|
|
1681
1683
|
} else if (is(field, Table)) {
|
|
1682
1684
|
result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
|
|
@@ -2168,7 +2170,8 @@ var init_date = __esm({
|
|
|
2168
2170
|
return "date";
|
|
2169
2171
|
}
|
|
2170
2172
|
mapFromDriverValue(value) {
|
|
2171
|
-
return new Date(value);
|
|
2173
|
+
if (typeof value === "string") return new Date(value);
|
|
2174
|
+
return value;
|
|
2172
2175
|
}
|
|
2173
2176
|
mapToDriverValue(value) {
|
|
2174
2177
|
return value.toISOString();
|
|
@@ -2192,6 +2195,10 @@ var init_date = __esm({
|
|
|
2192
2195
|
getSQLType() {
|
|
2193
2196
|
return "date";
|
|
2194
2197
|
}
|
|
2198
|
+
mapFromDriverValue(value) {
|
|
2199
|
+
if (typeof value === "string") return value;
|
|
2200
|
+
return value.toISOString().slice(0, -14);
|
|
2201
|
+
}
|
|
2195
2202
|
};
|
|
2196
2203
|
__publicField(PgDateString, _a58, "PgDateString");
|
|
2197
2204
|
}
|
|
@@ -3130,9 +3137,6 @@ var init_timestamp = __esm({
|
|
|
3130
3137
|
super(table6, config);
|
|
3131
3138
|
__publicField(this, "withTimezone");
|
|
3132
3139
|
__publicField(this, "precision");
|
|
3133
|
-
__publicField(this, "mapFromDriverValue", (value) => {
|
|
3134
|
-
return new Date(this.withTimezone ? value : value + "+0000");
|
|
3135
|
-
});
|
|
3136
3140
|
__publicField(this, "mapToDriverValue", (value) => {
|
|
3137
3141
|
return value.toISOString();
|
|
3138
3142
|
});
|
|
@@ -3143,6 +3147,10 @@ var init_timestamp = __esm({
|
|
|
3143
3147
|
const precision = this.precision === void 0 ? "" : ` (${this.precision})`;
|
|
3144
3148
|
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
3145
3149
|
}
|
|
3150
|
+
mapFromDriverValue(value) {
|
|
3151
|
+
if (typeof value === "string") return new Date(this.withTimezone ? value : value + "+0000");
|
|
3152
|
+
return value;
|
|
3153
|
+
}
|
|
3146
3154
|
};
|
|
3147
3155
|
__publicField(PgTimestamp, _a106, "PgTimestamp");
|
|
3148
3156
|
PgTimestampStringBuilder = class extends (_b86 = PgDateColumnBaseBuilder, _a107 = entityKind, _b86) {
|
|
@@ -3172,6 +3180,16 @@ var init_timestamp = __esm({
|
|
|
3172
3180
|
const precision = this.precision === void 0 ? "" : `(${this.precision})`;
|
|
3173
3181
|
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
3174
3182
|
}
|
|
3183
|
+
mapFromDriverValue(value) {
|
|
3184
|
+
if (typeof value === "string") return value;
|
|
3185
|
+
const shortened = value.toISOString().slice(0, -1).replace("T", " ");
|
|
3186
|
+
if (this.withTimezone) {
|
|
3187
|
+
const offset = value.getTimezoneOffset();
|
|
3188
|
+
const sign = offset <= 0 ? "+" : "-";
|
|
3189
|
+
return `${shortened}${sign}${Math.floor(Math.abs(offset) / 60).toString().padStart(2, "0")}`;
|
|
3190
|
+
}
|
|
3191
|
+
return shortened;
|
|
3192
|
+
}
|
|
3175
3193
|
};
|
|
3176
3194
|
__publicField(PgTimestampString, _a108, "PgTimestampString");
|
|
3177
3195
|
}
|
|
@@ -6047,8 +6065,8 @@ var init_indexes = __esm({
|
|
|
6047
6065
|
this.config.using = using;
|
|
6048
6066
|
return this;
|
|
6049
6067
|
}
|
|
6050
|
-
|
|
6051
|
-
this.config.
|
|
6068
|
+
algorithm(algorithm) {
|
|
6069
|
+
this.config.algorithm = algorithm;
|
|
6052
6070
|
return this;
|
|
6053
6071
|
}
|
|
6054
6072
|
lock(lock) {
|
|
@@ -6595,7 +6613,8 @@ var init_dialect = __esm({
|
|
|
6595
6613
|
const setSize = columnNames.length;
|
|
6596
6614
|
return sql.join(columnNames.flatMap((colName, i8) => {
|
|
6597
6615
|
const col = tableColumns[colName];
|
|
6598
|
-
const
|
|
6616
|
+
const onUpdateFnResult = col.onUpdateFn?.();
|
|
6617
|
+
const value = set[colName] ?? (is(onUpdateFnResult, SQL) ? onUpdateFnResult : sql.param(onUpdateFnResult, col));
|
|
6599
6618
|
const res = sql`${sql.identifier(this.casing.getColumnCasing(col))} = ${value}`;
|
|
6600
6619
|
if (i8 < setSize - 1) {
|
|
6601
6620
|
return [res, sql.raw(", ")];
|
|
@@ -6654,6 +6673,16 @@ var init_dialect = __esm({
|
|
|
6654
6673
|
} else {
|
|
6655
6674
|
chunk.push(field);
|
|
6656
6675
|
}
|
|
6676
|
+
} else if (is(field, Subquery)) {
|
|
6677
|
+
const entries = Object.entries(field._.selectedFields);
|
|
6678
|
+
if (entries.length === 1) {
|
|
6679
|
+
const entry = entries[0][1];
|
|
6680
|
+
const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
|
|
6681
|
+
if (fieldDecoder) {
|
|
6682
|
+
field._.sql.decoder = fieldDecoder;
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
chunk.push(field);
|
|
6657
6686
|
}
|
|
6658
6687
|
if (i8 < columnsLen - 1) {
|
|
6659
6688
|
chunk.push(sql`, `);
|
|
@@ -9660,7 +9689,8 @@ var init_dialect2 = __esm({
|
|
|
9660
9689
|
const setSize = columnNames.length;
|
|
9661
9690
|
return sql.join(columnNames.flatMap((colName, i8) => {
|
|
9662
9691
|
const col = tableColumns[colName];
|
|
9663
|
-
const
|
|
9692
|
+
const onUpdateFnResult = col.onUpdateFn?.();
|
|
9693
|
+
const value = set[colName] ?? (is(onUpdateFnResult, SQL) ? onUpdateFnResult : sql.param(onUpdateFnResult, col));
|
|
9664
9694
|
const res = sql`${sql.identifier(this.casing.getColumnCasing(col))} = ${value}`;
|
|
9665
9695
|
if (i8 < setSize - 1) {
|
|
9666
9696
|
return [res, sql.raw(", ")];
|
|
@@ -9724,6 +9754,16 @@ var init_dialect2 = __esm({
|
|
|
9724
9754
|
} else {
|
|
9725
9755
|
chunk.push(field);
|
|
9726
9756
|
}
|
|
9757
|
+
} else if (is(field, Subquery)) {
|
|
9758
|
+
const entries = Object.entries(field._.selectedFields);
|
|
9759
|
+
if (entries.length === 1) {
|
|
9760
|
+
const entry = entries[0][1];
|
|
9761
|
+
const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
|
|
9762
|
+
if (fieldDecoder) {
|
|
9763
|
+
field._.sql.decoder = fieldDecoder;
|
|
9764
|
+
}
|
|
9765
|
+
}
|
|
9766
|
+
chunk.push(field);
|
|
9727
9767
|
}
|
|
9728
9768
|
if (i8 < columnsLen - 1) {
|
|
9729
9769
|
chunk.push(sql`, `);
|
|
@@ -15268,8 +15308,8 @@ var init_indexes3 = __esm({
|
|
|
15268
15308
|
this.config.using = using;
|
|
15269
15309
|
return this;
|
|
15270
15310
|
}
|
|
15271
|
-
|
|
15272
|
-
this.config.
|
|
15311
|
+
algorithm(algorithm) {
|
|
15312
|
+
this.config.algorithm = algorithm;
|
|
15273
15313
|
return this;
|
|
15274
15314
|
}
|
|
15275
15315
|
lock(lock) {
|
|
@@ -15829,7 +15869,8 @@ var init_dialect3 = __esm({
|
|
|
15829
15869
|
const setSize = columnNames.length;
|
|
15830
15870
|
return sql.join(columnNames.flatMap((colName, i8) => {
|
|
15831
15871
|
const col = tableColumns[colName];
|
|
15832
|
-
const
|
|
15872
|
+
const onUpdateFnResult = col.onUpdateFn?.();
|
|
15873
|
+
const value = set[colName] ?? (is(onUpdateFnResult, SQL) ? onUpdateFnResult : sql.param(onUpdateFnResult, col));
|
|
15833
15874
|
const res = sql`${sql.identifier(this.casing.getColumnCasing(col))} = ${value}`;
|
|
15834
15875
|
if (i8 < setSize - 1) {
|
|
15835
15876
|
return [res, sql.raw(", ")];
|
|
@@ -15888,6 +15929,16 @@ var init_dialect3 = __esm({
|
|
|
15888
15929
|
} else {
|
|
15889
15930
|
chunk.push(field);
|
|
15890
15931
|
}
|
|
15932
|
+
} else if (is(field, Subquery)) {
|
|
15933
|
+
const entries = Object.entries(field._.selectedFields);
|
|
15934
|
+
if (entries.length === 1) {
|
|
15935
|
+
const entry = entries[0][1];
|
|
15936
|
+
const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
|
|
15937
|
+
if (fieldDecoder) {
|
|
15938
|
+
field._.sql.decoder = fieldDecoder;
|
|
15939
|
+
}
|
|
15940
|
+
}
|
|
15941
|
+
chunk.push(field);
|
|
15891
15942
|
}
|
|
15892
15943
|
if (i8 < columnsLen - 1) {
|
|
15893
15944
|
chunk.push(sql`, `);
|
|
@@ -18878,7 +18929,8 @@ var init_dialect4 = __esm({
|
|
|
18878
18929
|
const setSize = columnNames.length;
|
|
18879
18930
|
return sql.join(columnNames.flatMap((colName, i8) => {
|
|
18880
18931
|
const col = tableColumns[colName];
|
|
18881
|
-
const
|
|
18932
|
+
const onUpdateFnResult = col.onUpdateFn?.();
|
|
18933
|
+
const value = set[colName] ?? (is(onUpdateFnResult, SQL) ? onUpdateFnResult : sql.param(onUpdateFnResult, col));
|
|
18882
18934
|
const res = sql`${sql.identifier(this.casing.getColumnCasing(col))} = ${value}`;
|
|
18883
18935
|
if (i8 < setSize - 1) {
|
|
18884
18936
|
return [res, sql.raw(", ")];
|
|
@@ -18950,6 +19002,14 @@ var init_dialect4 = __esm({
|
|
|
18950
19002
|
chunk.push(sql`${sql.identifier(tableName)}.${sql.identifier(this.casing.getColumnCasing(field))}`);
|
|
18951
19003
|
}
|
|
18952
19004
|
}
|
|
19005
|
+
} else if (is(field, Subquery)) {
|
|
19006
|
+
const entries = Object.entries(field._.selectedFields);
|
|
19007
|
+
if (entries.length === 1) {
|
|
19008
|
+
const entry = entries[0][1];
|
|
19009
|
+
const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
|
|
19010
|
+
if (fieldDecoder) field._.sql.decoder = fieldDecoder;
|
|
19011
|
+
}
|
|
19012
|
+
chunk.push(field);
|
|
18953
19013
|
}
|
|
18954
19014
|
if (i8 < columnsLen - 1) {
|
|
18955
19015
|
chunk.push(sql`, `);
|
|
@@ -46316,7 +46376,7 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
|
46316
46376
|
columns: indexColumns,
|
|
46317
46377
|
isUnique: value.config.unique ?? false,
|
|
46318
46378
|
using: value.config.using,
|
|
46319
|
-
algorithm: value.config.
|
|
46379
|
+
algorithm: value.config.algorithm,
|
|
46320
46380
|
lock: value.config.lock
|
|
46321
46381
|
};
|
|
46322
46382
|
});
|
|
@@ -47447,7 +47507,7 @@ The unique index ${source_default.underline.blue(
|
|
|
47447
47507
|
columns: indexColumns,
|
|
47448
47508
|
isUnique: value.config.unique ?? false,
|
|
47449
47509
|
using: value.config.using,
|
|
47450
|
-
algorithm: value.config.
|
|
47510
|
+
algorithm: value.config.algorithm,
|
|
47451
47511
|
lock: value.config.lock
|
|
47452
47512
|
};
|
|
47453
47513
|
});
|
|
@@ -97810,7 +97870,7 @@ var init_core = __esm({
|
|
|
97810
97870
|
});
|
|
97811
97871
|
|
|
97812
97872
|
// ../drizzle-orm/dist/node-postgres/session.js
|
|
97813
|
-
var Pool2, types4, _a461, _b335, NodePgPreparedQuery, _a462, _b336, _NodePgSession, NodePgSession, _a463, _b337, _NodePgTransaction, NodePgTransaction;
|
|
97873
|
+
var Pool2, types4, NativePool, _a461, _b335, NodePgPreparedQuery, _a462, _b336, _NodePgSession, NodePgSession, _a463, _b337, _NodePgTransaction, NodePgTransaction;
|
|
97814
97874
|
var init_session7 = __esm({
|
|
97815
97875
|
"../drizzle-orm/dist/node-postgres/session.js"() {
|
|
97816
97876
|
"use strict";
|
|
@@ -97824,6 +97884,7 @@ var init_session7 = __esm({
|
|
|
97824
97884
|
init_tracing();
|
|
97825
97885
|
init_utils();
|
|
97826
97886
|
({ Pool: Pool2, types: types4 } = esm_default);
|
|
97887
|
+
NativePool = esm_default.native ? esm_default.native.Pool : void 0;
|
|
97827
97888
|
NodePgPreparedQuery = class extends (_b335 = PgPreparedQuery, _a461 = entityKind, _b335) {
|
|
97828
97889
|
constructor(client, queryString, params, logger2, cache5, queryMetadata, cacheConfig, fields, name3, _isResponseInArrayMode, customResultMapper) {
|
|
97829
97890
|
super({ sql: queryString, params }, cache5, queryMetadata, cacheConfig);
|
|
@@ -97993,7 +98054,7 @@ var init_session7 = __esm({
|
|
|
97993
98054
|
);
|
|
97994
98055
|
}
|
|
97995
98056
|
async transaction(transaction, config) {
|
|
97996
|
-
const session = this.client instanceof Pool2 ? new _NodePgSession(await this.client.connect(), this.dialect, this.schema, this.options) : this;
|
|
98057
|
+
const session = this.client instanceof Pool2 || NativePool && this.client instanceof NativePool ? new _NodePgSession(await this.client.connect(), this.dialect, this.schema, this.options) : this;
|
|
97997
98058
|
const tx = new NodePgTransaction(this.dialect, session, this.schema);
|
|
97998
98059
|
await tx.execute(sql`begin${config ? sql` ${tx.getTransactionConfigSQL(config)}` : void 0}`);
|
|
97999
98060
|
try {
|
|
@@ -98004,7 +98065,7 @@ var init_session7 = __esm({
|
|
|
98004
98065
|
await tx.execute(sql`rollback`);
|
|
98005
98066
|
throw error2;
|
|
98006
98067
|
} finally {
|
|
98007
|
-
if (this.client instanceof Pool2) {
|
|
98068
|
+
if (this.client instanceof Pool2 || NativePool && this.client instanceof NativePool) {
|
|
98008
98069
|
session.client.release();
|
|
98009
98070
|
}
|
|
98010
98071
|
}
|
package/bin.cjs
CHANGED
|
@@ -17955,7 +17955,7 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
|
17955
17955
|
columns: indexColumns,
|
|
17956
17956
|
isUnique: value.config.unique ?? false,
|
|
17957
17957
|
using: value.config.using,
|
|
17958
|
-
algorithm: value.config.
|
|
17958
|
+
algorithm: value.config.algorithm,
|
|
17959
17959
|
lock: value.config.lock
|
|
17960
17960
|
};
|
|
17961
17961
|
});
|
|
@@ -21151,7 +21151,7 @@ The unique index ${source_default.underline.blue(
|
|
|
21151
21151
|
columns: indexColumns,
|
|
21152
21152
|
isUnique: value.config.unique ?? false,
|
|
21153
21153
|
using: value.config.using,
|
|
21154
|
-
algorithm: value.config.
|
|
21154
|
+
algorithm: value.config.algorithm,
|
|
21155
21155
|
lock: value.config.lock
|
|
21156
21156
|
};
|
|
21157
21157
|
});
|
|
@@ -94333,7 +94333,7 @@ init_utils5();
|
|
|
94333
94333
|
var version2 = async () => {
|
|
94334
94334
|
const { npmVersion } = await ormCoreVersions();
|
|
94335
94335
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
|
94336
|
-
const envVersion = "0.31.
|
|
94336
|
+
const envVersion = "0.31.8-5c8a4c5";
|
|
94337
94337
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
|
94338
94338
|
const versions = `drizzle-kit: ${kitVersion}
|
|
94339
94339
|
${ormVersion}`;
|