Skip to content
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

Merged
merged 7 commits into from
Oct 11, 2024
Merged

Add type size when exporting postgres #258

merged 7 commits into from
Oct 11, 2024

Conversation

rudcode
Copy link
Contributor

@rudcode rudcode commented Oct 11, 2024

No description provided.

Copy link

vercel bot commented Oct 11, 2024

@rudcode is attempting to deploy a commit to the dottle's projects Team on Vercel.

A member of the Team first needs to authorize it.

hasPrecision: false,
defaultSize: 65535,
Copy link

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?

Copy link
Contributor Author

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.

@@ -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 + ")" : ""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
field.size !== undefined && field.size !== "" ? "(" + field.size + ")" : ""
field.size ? "(" + field.size + ")" : ""

isn't this enough? or we need to test against undefined/empty for some reason?

Copy link
Contributor Author

@rudcode rudcode Oct 11, 2024

Choose a reason for hiding this comment

The 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
But I think we need to test it against empty so it doesn't produce something like "VARCHAR()"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all fields have a size so yeah

Copy link

vercel bot commented Oct 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
drawdb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 11, 2024 11:42am

@1ilit 1ilit merged commit df54f86 into drawdb-io:main Oct 11, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants