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

fix export for enum and set types for mysql #252

Merged
merged 7 commits into from
Oct 11, 2024
Merged

Conversation

csc530
Copy link
Contributor

@csc530 csc530 commented Oct 2, 2024

fixes #251

I tested it with both enum and set types and gives the expected output.

It also shouldn't interfere with any other column types when exporting: as long as their field does not contain a values property.

Please, let me know if any changes or tests need to be made

Copy link

vercel bot commented Oct 2, 2024

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

A member of the Team first needs to authorize it.

Copy link
Member

@1ilit 1ilit left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. After you fix the comments could you also add this to mariadb as well?

src/utils/exportSQL/mysql.js Outdated Show resolved Hide resolved
return `${diagram.tables
.map(
(table) =>
`CREATE TABLE \`${table.name}\` (\n${table.fields
.map(
(field) =>
`\t\`${field.name}\` ${field.type}${field.unsigned ? " UNSIGNED" : ""}${field.size !== undefined && field.size !== "" ? "(" + field.size + ")" : ""}${
`\t\`${field.name}\` ${field.type}${field.values ? "(" + field.values.map(value=>"'" + value + "'").join(", ") + ")" : ""}${field.unsigned ? " UNSIGNED" : ""}${field.size !== undefined && field.size !== "" ? "(" + field.size + ")" : ""}${
Copy link
Member

Choose a reason for hiding this comment

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

Also, please format. If you're on vscode you can use alt+shift+f

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I'm using the default "typescript and javascript language features" formatter in vscode

csc530 added 3 commits October 2, 2024 10:29
using javascript and typescript language features extension in vscode
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There were a lot of changes when I used vscode's formatter (typeScript and JavaScript Language features extension) let me know if it's ok or if it should be undone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've realized now that the formatting settings can be changed and I likely don't have the config as was used in the project😅

same for src/utils/exportSQL/mysql.js

@csc530 csc530 requested a review from 1ilit October 3, 2024 15:11
@Amirbakhtiaro
Copy link

fixes #251

I tested it with both enum and set types and gives the expected output.

It also shouldn't interfere with any other column types when exporting: as long as their field does not contain a values property.

Please, let me know if any changes or tests need to be made

#252 (comment)

@Amirbakhtiaro
Copy link

Hi

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:05am

@1ilit 1ilit merged commit 7d3d1dd 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.

[BUG] MYSQL: incorrect syntax for SET and ENUM export SQL
4 participants