drizzle-kit 1.0.0-beta.5-5d28122 → 1.0.0-beta.6-4414a19
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-mysql.js +1 -0
- package/api-mysql.mjs +1 -0
- package/api-postgres.js +1 -0
- package/api-postgres.mjs +1 -0
- package/api-sqlite.js +1 -0
- package/api-sqlite.mjs +1 -0
- package/bin.cjs +31 -16
- package/package.json +1 -1
package/api-mysql.js
CHANGED
|
@@ -19441,6 +19441,7 @@ var init_grammar5 = __esm({
|
|
|
19441
19441
|
"use strict";
|
|
19442
19442
|
init_utils();
|
|
19443
19443
|
init_when_json_met_bigint();
|
|
19444
|
+
init_utils2();
|
|
19444
19445
|
viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
|
|
19445
19446
|
}
|
|
19446
19447
|
});
|
package/api-mysql.mjs
CHANGED
|
@@ -19453,6 +19453,7 @@ var init_grammar5 = __esm({
|
|
|
19453
19453
|
"use strict";
|
|
19454
19454
|
init_utils();
|
|
19455
19455
|
init_when_json_met_bigint();
|
|
19456
|
+
init_utils2();
|
|
19456
19457
|
viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
|
|
19457
19458
|
}
|
|
19458
19459
|
});
|
package/api-postgres.js
CHANGED
|
@@ -21566,6 +21566,7 @@ var init_grammar5 = __esm({
|
|
|
21566
21566
|
"use strict";
|
|
21567
21567
|
init_utils();
|
|
21568
21568
|
init_when_json_met_bigint();
|
|
21569
|
+
init_utils2();
|
|
21569
21570
|
viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
|
|
21570
21571
|
}
|
|
21571
21572
|
});
|
package/api-postgres.mjs
CHANGED
|
@@ -21572,6 +21572,7 @@ var init_grammar5 = __esm({
|
|
|
21572
21572
|
"use strict";
|
|
21573
21573
|
init_utils();
|
|
21574
21574
|
init_when_json_met_bigint();
|
|
21575
|
+
init_utils2();
|
|
21575
21576
|
viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
|
|
21576
21577
|
}
|
|
21577
21578
|
});
|
package/api-sqlite.js
CHANGED
|
@@ -19441,6 +19441,7 @@ var init_grammar5 = __esm({
|
|
|
19441
19441
|
"use strict";
|
|
19442
19442
|
init_utils();
|
|
19443
19443
|
init_when_json_met_bigint();
|
|
19444
|
+
init_utils2();
|
|
19444
19445
|
viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
|
|
19445
19446
|
}
|
|
19446
19447
|
});
|
package/api-sqlite.mjs
CHANGED
|
@@ -19453,6 +19453,7 @@ var init_grammar5 = __esm({
|
|
|
19453
19453
|
"use strict";
|
|
19454
19454
|
init_utils();
|
|
19455
19455
|
init_when_json_met_bigint();
|
|
19456
|
+
init_utils2();
|
|
19456
19457
|
viewAsStatementRegex = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
|
|
19457
19458
|
}
|
|
19458
19459
|
});
|
package/bin.cjs
CHANGED
|
@@ -28302,12 +28302,13 @@ function parseToHex(value) {
|
|
|
28302
28302
|
}
|
|
28303
28303
|
return value;
|
|
28304
28304
|
}
|
|
28305
|
-
var namedCheckPattern, unnamedCheckPattern, viewAsStatementRegex2, nameForForeignKey, nameForUnique2, nameForPk, intAffinities, Int5, realAffinities, Real5, numericAffinities, Numeric3, textAffinities, Text4, Blob3, typeFor5, parseDefault2, parseTableSQL, parseViewSQL2, defaultsCommutative3, transformOnUpdateDelete;
|
|
28305
|
+
var namedCheckPattern, unnamedCheckPattern, viewAsStatementRegex2, nameForForeignKey, nameForUnique2, nameForPk, intAffinities, Int5, realAffinities, Real5, numericAffinities, Numeric3, textAffinities, Text4, Blob3, Custom5, typeFor5, parseDefault2, parseTableSQL, parseViewSQL2, defaultsCommutative3, transformOnUpdateDelete;
|
|
28306
28306
|
var init_grammar5 = __esm({
|
|
28307
28307
|
"src/dialects/sqlite/grammar.ts"() {
|
|
28308
28308
|
"use strict";
|
|
28309
28309
|
init_utils2();
|
|
28310
28310
|
init_when_json_met_bigint();
|
|
28311
|
+
init_utils3();
|
|
28311
28312
|
namedCheckPattern = /CONSTRAINT\s+["'`[]?(\w+)["'`\]]?\s+CHECK\s*\((.*)\)/gi;
|
|
28312
28313
|
unnamedCheckPattern = /CHECK\s+\((.*)\)/gi;
|
|
28313
28314
|
viewAsStatementRegex2 = new RegExp(`\\bAS\\b\\s+(WITH.+|SELECT.+)$`, "is");
|
|
@@ -28434,7 +28435,7 @@ var init_grammar5 = __esm({
|
|
|
28434
28435
|
Text4 = {
|
|
28435
28436
|
is: function(type) {
|
|
28436
28437
|
const lowered = type.toLowerCase();
|
|
28437
|
-
return textAffinities.indexOf(lowered) >= 0 || lowered.startsWith("character(") || lowered.startsWith("varchar(") || lowered.startsWith("varying character(") || lowered.startsWith("nchar(") || lowered.startsWith("native character(") || lowered.startsWith("nvarchar(");
|
|
28438
|
+
return textAffinities.indexOf(lowered) >= 0 || lowered.startsWith("text(") || lowered.startsWith("character(") || lowered.startsWith("varchar(") || lowered.startsWith("varying character(") || lowered.startsWith("nchar(") || lowered.startsWith("native character(") || lowered.startsWith("nvarchar(") || lowered.startsWith("clob(");
|
|
28438
28439
|
},
|
|
28439
28440
|
drizzleImport: function() {
|
|
28440
28441
|
return "text";
|
|
@@ -28496,7 +28497,7 @@ var init_grammar5 = __esm({
|
|
|
28496
28497
|
defaultFromIntrospect: function(value) {
|
|
28497
28498
|
return value;
|
|
28498
28499
|
},
|
|
28499
|
-
toTs: function(value) {
|
|
28500
|
+
toTs: function(value, type) {
|
|
28500
28501
|
if (value === null) return "";
|
|
28501
28502
|
if (typeof Buffer !== "undefined" && value.startsWith("X'")) {
|
|
28502
28503
|
const parsed = Buffer.from(value.slice(2, value.length - 1), "hex").toString("utf-8");
|
|
@@ -28515,7 +28516,25 @@ var init_grammar5 = __esm({
|
|
|
28515
28516
|
}
|
|
28516
28517
|
} catch {
|
|
28517
28518
|
}
|
|
28518
|
-
return Text4.toTs(value);
|
|
28519
|
+
return Text4.toTs(value, type);
|
|
28520
|
+
}
|
|
28521
|
+
};
|
|
28522
|
+
Custom5 = {
|
|
28523
|
+
is: (_type) => {
|
|
28524
|
+
throw Error("Mocked");
|
|
28525
|
+
},
|
|
28526
|
+
drizzleImport: () => "customType",
|
|
28527
|
+
defaultFromDrizzle: (value) => {
|
|
28528
|
+
if (!value) return "";
|
|
28529
|
+
return String(value);
|
|
28530
|
+
},
|
|
28531
|
+
defaultFromIntrospect: (value) => {
|
|
28532
|
+
return value;
|
|
28533
|
+
},
|
|
28534
|
+
toTs: function(value, type) {
|
|
28535
|
+
if (!value) return { def: "", customType: type };
|
|
28536
|
+
const escaped = escapeForTsLiteral(value);
|
|
28537
|
+
return { def: escaped, customType: type };
|
|
28519
28538
|
}
|
|
28520
28539
|
};
|
|
28521
28540
|
typeFor5 = (sqlType) => {
|
|
@@ -28524,7 +28543,8 @@ var init_grammar5 = __esm({
|
|
|
28524
28543
|
if (Numeric3.is(sqlType)) return Numeric3;
|
|
28525
28544
|
if (Text4.is(sqlType)) return Text4;
|
|
28526
28545
|
if (Blob3.is(sqlType)) return Blob3;
|
|
28527
|
-
return Numeric3;
|
|
28546
|
+
if (Numeric3.is(sqlType)) return Numeric3;
|
|
28547
|
+
return Custom5;
|
|
28528
28548
|
};
|
|
28529
28549
|
parseDefault2 = (type, it2) => {
|
|
28530
28550
|
if (it2 === null) return null;
|
|
@@ -171549,7 +171569,7 @@ var init_typescript3 = __esm({
|
|
|
171549
171569
|
init_utils();
|
|
171550
171570
|
init_utils2();
|
|
171551
171571
|
init_grammar5();
|
|
171552
|
-
imports3 = ["integer", "real", "text", "numeric", "blob"];
|
|
171572
|
+
imports3 = ["integer", "real", "text", "numeric", "blob", "customType"];
|
|
171553
171573
|
sqliteImports = /* @__PURE__ */ new Set([
|
|
171554
171574
|
"sqliteTable",
|
|
171555
171575
|
...imports3
|
|
@@ -171598,7 +171618,7 @@ var init_typescript3 = __esm({
|
|
|
171598
171618
|
for (const it2 of schema5.entities.list()) {
|
|
171599
171619
|
if (it2.entityType === "indexes") imports6.add(it2.isUnique ? "uniqueIndex" : "index");
|
|
171600
171620
|
if (it2.entityType === "pks" && it2.columns.length > 1) imports6.add("primaryKey");
|
|
171601
|
-
if (it2.entityType === "uniques"
|
|
171621
|
+
if (it2.entityType === "uniques") imports6.add("unique");
|
|
171602
171622
|
if (it2.entityType === "checks") imports6.add("check");
|
|
171603
171623
|
if (it2.entityType === "columns") columnTypes.add(it2.type);
|
|
171604
171624
|
if (it2.entityType === "views") imports6.add("sqliteView");
|
|
@@ -171702,11 +171722,11 @@ import { sql } from "drizzle-orm"
|
|
|
171702
171722
|
const grammarType = typeFor5(type);
|
|
171703
171723
|
if (grammarType) {
|
|
171704
171724
|
const drizzleType = grammarType.drizzleImport();
|
|
171705
|
-
const res = grammarType.toTs(defaultValue);
|
|
171706
|
-
const { def, options } = typeof res === "string" ? { def: res } : res;
|
|
171725
|
+
const res = grammarType.toTs(defaultValue, type);
|
|
171726
|
+
const { def, options, customType } = typeof res === "string" ? { def: res } : res;
|
|
171707
171727
|
const defaultStatement = def ? `.default(${def})` : "";
|
|
171708
171728
|
const opts = options ? `${JSON.stringify(options)}` : "";
|
|
171709
|
-
return `${withCasing3(name, casing2)}: ${drizzleType}(${dbColumnName3({ name, casing: casing2, withMode: Boolean(opts) })}${opts})${defaultStatement}`;
|
|
171729
|
+
return `${withCasing3(name, casing2)}: ${drizzleType}${customType ? `({ dataType: () => '${customType}' })` : ""}(${dbColumnName3({ name, casing: casing2, withMode: Boolean(opts) })}${opts})${defaultStatement}`;
|
|
171710
171730
|
}
|
|
171711
171731
|
if (lowered.startsWith("text")) {
|
|
171712
171732
|
const match3 = lowered.match(/\d+/);
|
|
@@ -171762,9 +171782,6 @@ import { sql } from "drizzle-orm"
|
|
|
171762
171782
|
createTableIndexes3 = (tableName, idxs, casing2) => {
|
|
171763
171783
|
let statement = "";
|
|
171764
171784
|
for (const it2 of idxs) {
|
|
171765
|
-
let idxKey = it2.name.startsWith(tableName) && it2.name !== tableName ? it2.name.slice(tableName.length + 1) : it2.name;
|
|
171766
|
-
idxKey = idxKey.endsWith("_index") ? idxKey.slice(0, -"_index".length) + "_idx" : idxKey;
|
|
171767
|
-
idxKey = withCasing3(idxKey, casing2);
|
|
171768
171785
|
const columnNames = it2.columns.filter((c5) => !c5.isExpression).map((c5) => c5.value);
|
|
171769
171786
|
const indexGeneratedName = `${tableName}_${columnNames.join("_")}_index`;
|
|
171770
171787
|
const escapedIndexName = indexGeneratedName === it2.name ? "" : `"${it2.name}"`;
|
|
@@ -171779,8 +171796,6 @@ import { sql } from "drizzle-orm"
|
|
|
171779
171796
|
createTableUniques2 = (unqs, casing2) => {
|
|
171780
171797
|
let statement = "";
|
|
171781
171798
|
unqs.forEach((it2) => {
|
|
171782
|
-
const idxKey = withCasing3(it2.name, casing2);
|
|
171783
|
-
statement += ` ${idxKey}: `;
|
|
171784
171799
|
statement += "unique(";
|
|
171785
171800
|
statement += `"${it2.name}")`;
|
|
171786
171801
|
statement += `.on(${it2.columns.map((it3) => `table.${withCasing3(it3, casing2)}`).join(", ")}),`;
|
|
@@ -183005,7 +183020,7 @@ init_views();
|
|
|
183005
183020
|
var version3 = async () => {
|
|
183006
183021
|
const { npmVersion } = await ormCoreVersions();
|
|
183007
183022
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
|
183008
|
-
const envVersion = "1.0.0-beta.
|
|
183023
|
+
const envVersion = "1.0.0-beta.6";
|
|
183009
183024
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
|
183010
183025
|
const versions = `drizzle-kit: ${kitVersion}
|
|
183011
183026
|
${ormVersion}`;
|