Merge pull request #258 from rudcode/main
Add type size when exporting postgres
This commit is contained in:
commit
df54f864da
@ -857,9 +857,8 @@ const postgresTypesBase = {
|
|||||||
return field.default.length <= field.size;
|
return field.default.length <= field.size;
|
||||||
},
|
},
|
||||||
hasCheck: true,
|
hasCheck: true,
|
||||||
isSized: true,
|
isSized: false,
|
||||||
hasPrecision: false,
|
hasPrecision: false,
|
||||||
defaultSize: 65535,
|
|
||||||
hasQuotes: true,
|
hasQuotes: true,
|
||||||
},
|
},
|
||||||
BYTEA: {
|
BYTEA: {
|
||||||
|
@ -31,7 +31,9 @@ export function toPostgres(diagram) {
|
|||||||
(field) =>
|
(field) =>
|
||||||
`${exportFieldComment(field.comment)}\t"${
|
`${exportFieldComment(field.comment)}\t"${
|
||||||
field.name
|
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.increment ? " GENERATED BY DEFAULT AS IDENTITY" : ""
|
||||||
}${
|
}${
|
||||||
field.default.trim() !== ""
|
field.default.trim() !== ""
|
||||||
|
Loading…
Reference in New Issue
Block a user