Skip to content

Commit effeefe

Browse files
committed
fix: Handle empty string defaults for MySQL VARCHAR types to avoid syntax errors in drizzle-kit pull
1 parent 4b594de commit effeefe

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drizzle-kit/src/introspect-mysql.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,13 @@ const column = (
669669
} })`;
670670

671671
const mappedDefaultValue = mapColumnDefault(defaultValue, isExpression);
672-
out += defaultValue
673-
? `.default(${isExpression ? mappedDefaultValue : unescapeSingleQuotes(mappedDefaultValue, true)})`
674-
: '';
672+
if (defaultValue === "''") {
673+
out += ".default('')";
674+
} else {
675+
out += defaultValue
676+
? `.default(${isExpression ? mappedDefaultValue : unescapeSingleQuotes(mappedDefaultValue, true)})`
677+
: '';
678+
}
675679
return out;
676680
}
677681

0 commit comments

Comments
 (0)