-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add type size when exporting postgres #258
Changes from 6 commits
b56024b
257209c
c78245c
6314f98
5c2262e
25542b5
d208e37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -31,7 +31,11 @@ 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 + ")" : "" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
isn't this enough? or we need to test against undefined/empty for some reason? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, I just copy this from https://github.com/drawdb-io/drawdb/blob/main/src/utils/exportSQL/mysql.js#L12 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not all fields have a size so yeah |
||||||
}${field.isArray ? " ARRAY" : ""}${field.notNull ? " NOT NULL" : ""}${field.unique ? " UNIQUE" : ""}${ | ||||||
field.increment ? " GENERATED BY DEFAULT AS IDENTITY" : "" | ||||||
}${ | ||||||
field.default.trim() !== "" | ||||||
? ` DEFAULT ${parseDefault(field, diagram.database)}` | ||||||
: "" | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how these changes would impact other database engines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't impact any other database, because each database have their own {database}TypesBase.