Skip to content

Commit

Permalink
Merge pull request #258 from rudcode/main
Browse files Browse the repository at this point in the history
Add type size when exporting postgres
  • Loading branch information
1ilit authored Oct 11, 2024
2 parents 9f834da + d208e37 commit df54f86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/data/datatypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -857,9 +857,8 @@ const postgresTypesBase = {
return field.default.length <= field.size;
},
hasCheck: true,
isSized: true,
isSized: false,
hasPrecision: false,
defaultSize: 65535,
hasQuotes: true,
},
BYTEA: {
Expand Down
4 changes: 3 additions & 1 deletion src/utils/exportSQL/postgres.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() !== ""
Expand Down

0 comments on commit df54f86

Please sign in to comment.