Skip to content

Commit 24d56cc

Browse files
authored
Use unsigned keyword only if type is signed (#528)
1 parent a5718f8 commit 24d56cc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/utils/exportSQL/mysql.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ export function toMySQL(diagram) {
2727
`CREATE TABLE \`${table.name}\` (\n${table.fields
2828
.map(
2929
(field) =>
30-
`\t\`${field.name}\` ${parseType(field)}${field.unsigned ? " UNSIGNED" : ""}${
31-
field.notNull ? " NOT NULL" : ""
32-
}${
30+
`\t\`${field.name}\` ${parseType(field)}${
31+
dbToTypes[DB.MYSQL][field.type]?.signed && field.unsigned
32+
? " UNSIGNED"
33+
: ""
34+
}${field.notNull ? " NOT NULL" : ""}${
3335
field.increment ? " AUTO_INCREMENT" : ""
3436
}${field.unique ? " UNIQUE" : ""}${
3537
field.default !== ""

0 commit comments

Comments
 (0)