From 24d56cc7bf48fdd5217a262acd69012622eb13ac Mon Sep 17 00:00:00 2001 From: 1ilit <1ilit@proton.me> Date: Tue, 8 Jul 2025 22:12:14 +0400 Subject: [PATCH] Use unsigned keyword only if type is signed (#528) --- src/utils/exportSQL/mysql.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/exportSQL/mysql.js b/src/utils/exportSQL/mysql.js index 6d9d4fb..a835778 100644 --- a/src/utils/exportSQL/mysql.js +++ b/src/utils/exportSQL/mysql.js @@ -27,9 +27,11 @@ export function toMySQL(diagram) { `CREATE TABLE \`${table.name}\` (\n${table.fields .map( (field) => - `\t\`${field.name}\` ${parseType(field)}${field.unsigned ? " UNSIGNED" : ""}${ - field.notNull ? " NOT NULL" : "" - }${ + `\t\`${field.name}\` ${parseType(field)}${ + dbToTypes[DB.MYSQL][field.type]?.signed && field.unsigned + ? " UNSIGNED" + : "" + }${field.notNull ? " NOT NULL" : ""}${ field.increment ? " AUTO_INCREMENT" : "" }${field.unique ? " UNIQUE" : ""}${ field.default !== ""