bun-query-builder 0.2.12 → 0.2.14
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/dist/bin/cli.js +9 -6
- package/dist/src/index.js +8 -5
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -18168,7 +18168,10 @@ class MySQLDriver {
|
|
|
18168
18168
|
if (rawSqlExpressions.includes(upperDv)) {
|
|
18169
18169
|
return `default ${upperDv}`;
|
|
18170
18170
|
}
|
|
18171
|
-
|
|
18171
|
+
const literal = `'${dv.replace(/'/g, "''")}'`;
|
|
18172
|
+
if (column.type === "text" || column.type === "json" || column.type === "enum" && !column.enumValues?.length)
|
|
18173
|
+
return `default (${literal})`;
|
|
18174
|
+
return `default ${literal}`;
|
|
18172
18175
|
} else if (typeof dv === "number" || typeof dv === "bigint") {
|
|
18173
18176
|
return `default ${dv}`;
|
|
18174
18177
|
} else if (typeof dv === "boolean") {
|
|
@@ -28416,7 +28419,7 @@ function detectTypeFromValidationRule(rule) {
|
|
|
28416
28419
|
case "string":
|
|
28417
28420
|
case "text": {
|
|
28418
28421
|
const maxValue = extractMaxFromRules(ruleObj);
|
|
28419
|
-
return maxValue && maxValue >
|
|
28422
|
+
return maxValue && maxValue > MAX_BOUNDED_VARCHAR_LENGTH ? "text" : "string";
|
|
28420
28423
|
}
|
|
28421
28424
|
case "integer":
|
|
28422
28425
|
case "int":
|
|
@@ -28566,7 +28569,7 @@ function buildMigrationPlan2(models, options) {
|
|
|
28566
28569
|
inferred = normalizeAttributeType(attr.type) ?? detectTypeFromValidationRule(attr.validation?.rule);
|
|
28567
28570
|
if (inferred === "string") {
|
|
28568
28571
|
const maxLength = extractMaxFromRules(attr.validation?.rule);
|
|
28569
|
-
if (maxLength && maxLength >
|
|
28572
|
+
if (maxLength && maxLength > MAX_BOUNDED_VARCHAR_LENGTH)
|
|
28570
28573
|
inferred = "text";
|
|
28571
28574
|
}
|
|
28572
28575
|
if (!inferred || inferred === "enum") {
|
|
@@ -28605,7 +28608,7 @@ function buildMigrationPlan2(models, options) {
|
|
|
28605
28608
|
hasDefault: typeof attr.default !== "undefined",
|
|
28606
28609
|
defaultValue: normalizeDefaultValue(attr.default),
|
|
28607
28610
|
enumValues,
|
|
28608
|
-
maxLength: typeof maxLen === "number" && maxLen > 0 && maxLen <=
|
|
28611
|
+
maxLength: typeof maxLen === "number" && maxLen > 0 && maxLen <= MAX_BOUNDED_VARCHAR_LENGTH ? maxLen : undefined
|
|
28609
28612
|
};
|
|
28610
28613
|
if (columnName.endsWith("_id") && attr.foreignKey !== false && !polymorphicColumns.has(columnName)) {
|
|
28611
28614
|
if (typeof attr.foreignKey === "object" && attr.foreignKey !== null) {
|
|
@@ -29450,7 +29453,7 @@ function generateDiffOperations(previous, next, opts = {}) {
|
|
|
29450
29453
|
function generateDiffSql(previous, next, opts = {}) {
|
|
29451
29454
|
return generateDiffOperations(previous, next, opts).statements;
|
|
29452
29455
|
}
|
|
29453
|
-
var migrationCounter = 0, migrationsCreatedCount = 0, migrationsUpdatedCount = 0, useDeterministicNames = true, createdMigrationFiles, existingCorpusBodies = null, GENERATED_MARKER = "-- qb:generated";
|
|
29456
|
+
var migrationCounter = 0, migrationsCreatedCount = 0, migrationsUpdatedCount = 0, useDeterministicNames = true, createdMigrationFiles, existingCorpusBodies = null, GENERATED_MARKER = "-- qb:generated", MAX_BOUNDED_VARCHAR_LENGTH = 767;
|
|
29454
29457
|
var init_migrations = __esm(() => {
|
|
29455
29458
|
init_config();
|
|
29456
29459
|
init_drivers();
|
|
@@ -31539,7 +31542,7 @@ function getPrefix() {
|
|
|
31539
31542
|
}
|
|
31540
31543
|
var prefix = getPrefix();
|
|
31541
31544
|
// package.json
|
|
31542
|
-
var version2 = "0.2.
|
|
31545
|
+
var version2 = "0.2.14";
|
|
31543
31546
|
|
|
31544
31547
|
// bin/cli.ts
|
|
31545
31548
|
init_actions();
|
package/dist/src/index.js
CHANGED
|
@@ -18167,7 +18167,10 @@ class MySQLDriver {
|
|
|
18167
18167
|
if (rawSqlExpressions.includes(upperDv)) {
|
|
18168
18168
|
return `default ${upperDv}`;
|
|
18169
18169
|
}
|
|
18170
|
-
|
|
18170
|
+
const literal = `'${dv.replace(/'/g, "''")}'`;
|
|
18171
|
+
if (column.type === "text" || column.type === "json" || column.type === "enum" && !column.enumValues?.length)
|
|
18172
|
+
return `default (${literal})`;
|
|
18173
|
+
return `default ${literal}`;
|
|
18171
18174
|
} else if (typeof dv === "number" || typeof dv === "bigint") {
|
|
18172
18175
|
return `default ${dv}`;
|
|
18173
18176
|
} else if (typeof dv === "boolean") {
|
|
@@ -28415,7 +28418,7 @@ function detectTypeFromValidationRule(rule) {
|
|
|
28415
28418
|
case "string":
|
|
28416
28419
|
case "text": {
|
|
28417
28420
|
const maxValue = extractMaxFromRules(ruleObj);
|
|
28418
|
-
return maxValue && maxValue >
|
|
28421
|
+
return maxValue && maxValue > MAX_BOUNDED_VARCHAR_LENGTH ? "text" : "string";
|
|
28419
28422
|
}
|
|
28420
28423
|
case "integer":
|
|
28421
28424
|
case "int":
|
|
@@ -28565,7 +28568,7 @@ function buildMigrationPlan2(models, options) {
|
|
|
28565
28568
|
inferred = normalizeAttributeType(attr.type) ?? detectTypeFromValidationRule(attr.validation?.rule);
|
|
28566
28569
|
if (inferred === "string") {
|
|
28567
28570
|
const maxLength = extractMaxFromRules(attr.validation?.rule);
|
|
28568
|
-
if (maxLength && maxLength >
|
|
28571
|
+
if (maxLength && maxLength > MAX_BOUNDED_VARCHAR_LENGTH)
|
|
28569
28572
|
inferred = "text";
|
|
28570
28573
|
}
|
|
28571
28574
|
if (!inferred || inferred === "enum") {
|
|
@@ -28604,7 +28607,7 @@ function buildMigrationPlan2(models, options) {
|
|
|
28604
28607
|
hasDefault: typeof attr.default !== "undefined",
|
|
28605
28608
|
defaultValue: normalizeDefaultValue(attr.default),
|
|
28606
28609
|
enumValues,
|
|
28607
|
-
maxLength: typeof maxLen === "number" && maxLen > 0 && maxLen <=
|
|
28610
|
+
maxLength: typeof maxLen === "number" && maxLen > 0 && maxLen <= MAX_BOUNDED_VARCHAR_LENGTH ? maxLen : undefined
|
|
28608
28611
|
};
|
|
28609
28612
|
if (columnName.endsWith("_id") && attr.foreignKey !== false && !polymorphicColumns.has(columnName)) {
|
|
28610
28613
|
if (typeof attr.foreignKey === "object" && attr.foreignKey !== null) {
|
|
@@ -29449,7 +29452,7 @@ function generateDiffOperations(previous, next, opts = {}) {
|
|
|
29449
29452
|
function generateDiffSql(previous, next, opts = {}) {
|
|
29450
29453
|
return generateDiffOperations(previous, next, opts).statements;
|
|
29451
29454
|
}
|
|
29452
|
-
var migrationCounter = 0, migrationsCreatedCount = 0, migrationsUpdatedCount = 0, useDeterministicNames = true, createdMigrationFiles, existingCorpusBodies = null, GENERATED_MARKER = "-- qb:generated";
|
|
29455
|
+
var migrationCounter = 0, migrationsCreatedCount = 0, migrationsUpdatedCount = 0, useDeterministicNames = true, createdMigrationFiles, existingCorpusBodies = null, GENERATED_MARKER = "-- qb:generated", MAX_BOUNDED_VARCHAR_LENGTH = 767;
|
|
29453
29456
|
var init_migrations = __esm(() => {
|
|
29454
29457
|
init_config();
|
|
29455
29458
|
init_drivers();
|
package/package.json
CHANGED