From 25542b58b3aed8588ccdd0277d7a8226451d84e2 Mon Sep 17 00:00:00 2001 From: Rudy Nurhadi Date: Fri, 11 Oct 2024 07:30:57 +0700 Subject: [PATCH] Add type size when exporting postgres --- src/utils/exportSQL/postgres.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/exportSQL/postgres.js b/src/utils/exportSQL/postgres.js index bccd4a8..d6b8107 100644 --- a/src/utils/exportSQL/postgres.js +++ b/src/utils/exportSQL/postgres.js @@ -31,7 +31,9 @@ export function toPostgres(diagram) { (field) => `${exportFieldComment(field.comment)}\t"${ field.name - }" ${field.type}${field.isArray ? " ARRAY" : ""}${field.notNull ? " NOT NULL" : ""}${field.unique ? " UNIQUE" : ""}${ + }" ${field.type}${ + field.size !== undefined && field.size !== "" ? "(" + field.size + ")" : "" + }${field.isArray ? " ARRAY" : ""}${field.notNull ? " NOT NULL" : ""}${field.unique ? " UNIQUE" : ""}${ field.increment ? " GENERATED BY DEFAULT AS IDENTITY" : "" }${ field.default.trim() !== ""