drizzle-kit 0.30.3 → 0.30.4
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 +13 -7
- package/api.mjs +13 -7
- package/bin.cjs +11 -10
- package/package.json +1 -1
package/api.js
CHANGED
@@ -22115,7 +22115,7 @@ var version;
|
|
22115
22115
|
var init_version = __esm({
|
22116
22116
|
"../drizzle-orm/dist/version.js"() {
|
22117
22117
|
"use strict";
|
22118
|
-
version = "0.39.
|
22118
|
+
version = "0.39.1";
|
22119
22119
|
}
|
22120
22120
|
});
|
22121
22121
|
|
@@ -22398,7 +22398,7 @@ var init_sql = __esm({
|
|
22398
22398
|
const schemaName = chunk[Table2.Symbol.Schema];
|
22399
22399
|
const tableName = chunk[Table2.Symbol.Name];
|
22400
22400
|
return {
|
22401
|
-
sql: schemaName === void 0 ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
22401
|
+
sql: schemaName === void 0 || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
22402
22402
|
params: []
|
22403
22403
|
};
|
22404
22404
|
}
|
@@ -22417,7 +22417,7 @@ var init_sql = __esm({
|
|
22417
22417
|
const schemaName = chunk[ViewBaseConfig].schema;
|
22418
22418
|
const viewName = chunk[ViewBaseConfig].name;
|
22419
22419
|
return {
|
22420
|
-
sql: schemaName === void 0 ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
22420
|
+
sql: schemaName === void 0 || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
22421
22421
|
params: []
|
22422
22422
|
};
|
22423
22423
|
}
|
@@ -32463,7 +32463,7 @@ var init_dialect2 = __esm({
|
|
32463
32463
|
const withSql = this.buildWithCTE(withList);
|
32464
32464
|
const valuesSql = sql.join(valuesSqlList);
|
32465
32465
|
const returningSql = returning ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` : void 0;
|
32466
|
-
const onConflictSql = onConflict ? sql
|
32466
|
+
const onConflictSql = onConflict?.length ? sql.join(onConflict) : void 0;
|
32467
32467
|
return sql`${withSql}insert into ${table5} ${insertOrder} ${valuesSql}${onConflictSql}${returningSql}`;
|
32468
32468
|
}
|
32469
32469
|
sqlToQuery(sql2, invokeSource) {
|
@@ -33570,12 +33570,14 @@ var init_insert2 = __esm({
|
|
33570
33570
|
* ```
|
33571
33571
|
*/
|
33572
33572
|
onConflictDoNothing(config = {}) {
|
33573
|
+
if (!this.config.onConflict)
|
33574
|
+
this.config.onConflict = [];
|
33573
33575
|
if (config.target === void 0) {
|
33574
|
-
this.config.onConflict
|
33576
|
+
this.config.onConflict.push(sql` on conflict do nothing`);
|
33575
33577
|
} else {
|
33576
33578
|
const targetSql = Array.isArray(config.target) ? sql`${config.target}` : sql`${[config.target]}`;
|
33577
33579
|
const whereSql = config.where ? sql` where ${config.where}` : sql``;
|
33578
|
-
this.config.onConflict
|
33580
|
+
this.config.onConflict.push(sql` on conflict ${targetSql} do nothing${whereSql}`);
|
33579
33581
|
}
|
33580
33582
|
return this;
|
33581
33583
|
}
|
@@ -33614,12 +33616,16 @@ var init_insert2 = __esm({
|
|
33614
33616
|
'You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.'
|
33615
33617
|
);
|
33616
33618
|
}
|
33619
|
+
if (!this.config.onConflict)
|
33620
|
+
this.config.onConflict = [];
|
33617
33621
|
const whereSql = config.where ? sql` where ${config.where}` : void 0;
|
33618
33622
|
const targetWhereSql = config.targetWhere ? sql` where ${config.targetWhere}` : void 0;
|
33619
33623
|
const setWhereSql = config.setWhere ? sql` where ${config.setWhere}` : void 0;
|
33620
33624
|
const targetSql = Array.isArray(config.target) ? sql`${config.target}` : sql`${[config.target]}`;
|
33621
33625
|
const setSql = this.dialect.buildUpdateSet(this.config.table, mapUpdateSet(this.config.table, config.set));
|
33622
|
-
this.config.onConflict
|
33626
|
+
this.config.onConflict.push(
|
33627
|
+
sql` on conflict ${targetSql}${targetWhereSql} do update set ${setSql}${whereSql}${setWhereSql}`
|
33628
|
+
);
|
33623
33629
|
return this;
|
33624
33630
|
}
|
33625
33631
|
/** @internal */
|
package/api.mjs
CHANGED
@@ -22120,7 +22120,7 @@ var version;
|
|
22120
22120
|
var init_version = __esm({
|
22121
22121
|
"../drizzle-orm/dist/version.js"() {
|
22122
22122
|
"use strict";
|
22123
|
-
version = "0.39.
|
22123
|
+
version = "0.39.1";
|
22124
22124
|
}
|
22125
22125
|
});
|
22126
22126
|
|
@@ -22403,7 +22403,7 @@ var init_sql = __esm({
|
|
22403
22403
|
const schemaName = chunk[Table2.Symbol.Schema];
|
22404
22404
|
const tableName = chunk[Table2.Symbol.Name];
|
22405
22405
|
return {
|
22406
|
-
sql: schemaName === void 0 ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
22406
|
+
sql: schemaName === void 0 || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
22407
22407
|
params: []
|
22408
22408
|
};
|
22409
22409
|
}
|
@@ -22422,7 +22422,7 @@ var init_sql = __esm({
|
|
22422
22422
|
const schemaName = chunk[ViewBaseConfig].schema;
|
22423
22423
|
const viewName = chunk[ViewBaseConfig].name;
|
22424
22424
|
return {
|
22425
|
-
sql: schemaName === void 0 ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
22425
|
+
sql: schemaName === void 0 || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
22426
22426
|
params: []
|
22427
22427
|
};
|
22428
22428
|
}
|
@@ -32468,7 +32468,7 @@ var init_dialect2 = __esm({
|
|
32468
32468
|
const withSql = this.buildWithCTE(withList);
|
32469
32469
|
const valuesSql = sql.join(valuesSqlList);
|
32470
32470
|
const returningSql = returning ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` : void 0;
|
32471
|
-
const onConflictSql = onConflict ? sql
|
32471
|
+
const onConflictSql = onConflict?.length ? sql.join(onConflict) : void 0;
|
32472
32472
|
return sql`${withSql}insert into ${table5} ${insertOrder} ${valuesSql}${onConflictSql}${returningSql}`;
|
32473
32473
|
}
|
32474
32474
|
sqlToQuery(sql2, invokeSource) {
|
@@ -33575,12 +33575,14 @@ var init_insert2 = __esm({
|
|
33575
33575
|
* ```
|
33576
33576
|
*/
|
33577
33577
|
onConflictDoNothing(config = {}) {
|
33578
|
+
if (!this.config.onConflict)
|
33579
|
+
this.config.onConflict = [];
|
33578
33580
|
if (config.target === void 0) {
|
33579
|
-
this.config.onConflict
|
33581
|
+
this.config.onConflict.push(sql` on conflict do nothing`);
|
33580
33582
|
} else {
|
33581
33583
|
const targetSql = Array.isArray(config.target) ? sql`${config.target}` : sql`${[config.target]}`;
|
33582
33584
|
const whereSql = config.where ? sql` where ${config.where}` : sql``;
|
33583
|
-
this.config.onConflict
|
33585
|
+
this.config.onConflict.push(sql` on conflict ${targetSql} do nothing${whereSql}`);
|
33584
33586
|
}
|
33585
33587
|
return this;
|
33586
33588
|
}
|
@@ -33619,12 +33621,16 @@ var init_insert2 = __esm({
|
|
33619
33621
|
'You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.'
|
33620
33622
|
);
|
33621
33623
|
}
|
33624
|
+
if (!this.config.onConflict)
|
33625
|
+
this.config.onConflict = [];
|
33622
33626
|
const whereSql = config.where ? sql` where ${config.where}` : void 0;
|
33623
33627
|
const targetWhereSql = config.targetWhere ? sql` where ${config.targetWhere}` : void 0;
|
33624
33628
|
const setWhereSql = config.setWhere ? sql` where ${config.setWhere}` : void 0;
|
33625
33629
|
const targetSql = Array.isArray(config.target) ? sql`${config.target}` : sql`${[config.target]}`;
|
33626
33630
|
const setSql = this.dialect.buildUpdateSet(this.config.table, mapUpdateSet(this.config.table, config.set));
|
33627
|
-
this.config.onConflict
|
33631
|
+
this.config.onConflict.push(
|
33632
|
+
sql` on conflict ${targetSql}${targetWhereSql} do update set ${setSql}${whereSql}${setWhereSql}`
|
33633
|
+
);
|
33628
33634
|
return this;
|
33629
33635
|
}
|
33630
33636
|
/** @internal */
|
package/bin.cjs
CHANGED
@@ -70965,7 +70965,7 @@ import { sql } from "drizzle-orm"
|
|
70965
70965
|
if (lowered.startsWith("int")) {
|
70966
70966
|
const isUnsigned = lowered.startsWith("int unsigned");
|
70967
70967
|
const columnName = dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned });
|
70968
|
-
let out = `${casing2(name)}: int(${columnName}${isUnsigned ?
|
70968
|
+
let out = `${casing2(name)}: int(${columnName}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
70969
70969
|
out += autoincrement ? `.autoincrement()` : "";
|
70970
70970
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
70971
70971
|
return out;
|
@@ -70973,7 +70973,7 @@ import { sql } from "drizzle-orm"
|
|
70973
70973
|
if (lowered.startsWith("tinyint")) {
|
70974
70974
|
const isUnsigned = lowered.startsWith("tinyint unsigned");
|
70975
70975
|
const columnName = dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned });
|
70976
|
-
let out = `${casing2(name)}: tinyint(${columnName}${isUnsigned ?
|
70976
|
+
let out = `${casing2(name)}: tinyint(${columnName}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
70977
70977
|
out += autoincrement ? `.autoincrement()` : "";
|
70978
70978
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
70979
70979
|
return out;
|
@@ -70981,7 +70981,7 @@ import { sql } from "drizzle-orm"
|
|
70981
70981
|
if (lowered.startsWith("smallint")) {
|
70982
70982
|
const isUnsigned = lowered.startsWith("smallint unsigned");
|
70983
70983
|
const columnName = dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned });
|
70984
|
-
let out = `${casing2(name)}: smallint(${columnName}${isUnsigned ?
|
70984
|
+
let out = `${casing2(name)}: smallint(${columnName}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
70985
70985
|
out += autoincrement ? `.autoincrement()` : "";
|
70986
70986
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
70987
70987
|
return out;
|
@@ -70989,7 +70989,7 @@ import { sql } from "drizzle-orm"
|
|
70989
70989
|
if (lowered.startsWith("mediumint")) {
|
70990
70990
|
const isUnsigned = lowered.startsWith("mediumint unsigned");
|
70991
70991
|
const columnName = dbColumnName2({ name, casing: rawCasing, withMode: isUnsigned });
|
70992
|
-
let out = `${casing2(name)}: mediumint(${columnName}${isUnsigned ?
|
70992
|
+
let out = `${casing2(name)}: mediumint(${columnName}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
70993
70993
|
out += autoincrement ? `.autoincrement()` : "";
|
70994
70994
|
out += defaultValue ? `.default(${mapColumnDefault2(defaultValue, isExpression)})` : "";
|
70995
70995
|
return out;
|
@@ -71239,7 +71239,8 @@ import { sql } from "drizzle-orm"
|
|
71239
71239
|
let idxKey = it.name.startsWith(tableName) && it.name !== tableName ? it.name.slice(tableName.length + 1) : it.name;
|
71240
71240
|
idxKey = idxKey.endsWith("_index") ? idxKey.slice(0, -"_index".length) + "_idx" : idxKey;
|
71241
71241
|
idxKey = casing2(idxKey);
|
71242
|
-
statement += `
|
71242
|
+
statement += `
|
71243
|
+
`;
|
71243
71244
|
statement += it.isUnique ? "uniqueIndex(" : "index(";
|
71244
71245
|
statement += `"${it.name}")`;
|
71245
71246
|
statement += `.on(${it.columns.map((it2) => `table.${casing2(it2)}`).join(", ")}),`;
|
@@ -72404,7 +72405,7 @@ import { sql } from "drizzle-orm"
|
|
72404
72405
|
if (lowered.startsWith("int")) {
|
72405
72406
|
const isUnsigned = lowered.includes("unsigned");
|
72406
72407
|
const columnName = dbColumnName4({ name, casing: rawCasing, withMode: isUnsigned });
|
72407
|
-
let out = `${casing2(name)}: int(${columnName}${isUnsigned ?
|
72408
|
+
let out = `${casing2(name)}: int(${columnName}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
72408
72409
|
out += autoincrement ? `.autoincrement()` : "";
|
72409
72410
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault4(defaultValue, isExpression)})` : "";
|
72410
72411
|
return out;
|
@@ -72412,7 +72413,7 @@ import { sql } from "drizzle-orm"
|
|
72412
72413
|
if (lowered.startsWith("tinyint")) {
|
72413
72414
|
const isUnsigned = lowered.includes("unsigned");
|
72414
72415
|
const columnName = dbColumnName4({ name, casing: rawCasing, withMode: isUnsigned });
|
72415
|
-
let out = `${casing2(name)}: tinyint(${columnName}${isUnsigned ?
|
72416
|
+
let out = `${casing2(name)}: tinyint(${columnName}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
72416
72417
|
out += autoincrement ? `.autoincrement()` : "";
|
72417
72418
|
out += typeof defaultValue !== "undefined" ? `.default(${mapColumnDefault4(defaultValue, isExpression)})` : "";
|
72418
72419
|
return out;
|
@@ -72420,7 +72421,7 @@ import { sql } from "drizzle-orm"
|
|
72420
72421
|
if (lowered.startsWith("smallint")) {
|
72421
72422
|
const isUnsigned = lowered.includes("unsigned");
|
72422
72423
|
const columnName = dbColumnName4({ name, casing: rawCasing, withMode: isUnsigned });
|
72423
|
-
let out = `${casing2(name)}: smallint(${columnName}${isUnsigned ?
|
72424
|
+
let out = `${casing2(name)}: smallint(${columnName}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
72424
72425
|
out += autoincrement ? `.autoincrement()` : "";
|
72425
72426
|
out += defaultValue ? `.default(${mapColumnDefault4(defaultValue, isExpression)})` : "";
|
72426
72427
|
return out;
|
@@ -72428,7 +72429,7 @@ import { sql } from "drizzle-orm"
|
|
72428
72429
|
if (lowered.startsWith("mediumint")) {
|
72429
72430
|
const isUnsigned = lowered.includes("unsigned");
|
72430
72431
|
const columnName = dbColumnName4({ name, casing: rawCasing, withMode: isUnsigned });
|
72431
|
-
let out = `${casing2(name)}: mediumint(${columnName}${isUnsigned ?
|
72432
|
+
let out = `${casing2(name)}: mediumint(${columnName}${isUnsigned ? "{ unsigned: true }" : ""})`;
|
72432
72433
|
out += autoincrement ? `.autoincrement()` : "";
|
72433
72434
|
out += defaultValue ? `.default(${mapColumnDefault4(defaultValue, isExpression)})` : "";
|
72434
72435
|
return out;
|
@@ -79541,7 +79542,7 @@ init_utils5();
|
|
79541
79542
|
var version2 = async () => {
|
79542
79543
|
const { npmVersion } = await ormCoreVersions();
|
79543
79544
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
79544
|
-
const envVersion = "0.30.
|
79545
|
+
const envVersion = "0.30.4";
|
79545
79546
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
79546
79547
|
const versions = `drizzle-kit: ${kitVersion}
|
79547
79548
|
${ormVersion}`;
|