Add type size when exporting postgres

This commit is contained in:
Rudy Nurhadi 2024-10-11 07:30:57 +07:00 committed by GitHub
parent 5c2262e759
commit 25542b58b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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() !== ""