Merge pull request #258 from rudcode/main

Add type size when exporting postgres
This commit is contained in:
1ilit 2024-10-11 15:45:09 +04:00 committed by GitHub
commit df54f864da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -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: {

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