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 sql tool error in windows #7519

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

san127127
Copy link

What changed?

Use path.Join() instead of filepath.Join()

Why?

#7454

How did you test it?

Tested locally

Potential risks

None

Documentation

None

Is hotfix candidate?

No

@san127127 san127127 requested a review from a team as a code owner March 24, 2025 03:50
@CLAassistant
Copy link

CLAassistant commented Mar 24, 2025

CLA assistant check
All committers have signed the CLA.

@@ -30,15 +30,13 @@ import (
// should not be used for anything more important (password hashes etc.). Marking it as #nosec because of how it's
// being used.
"crypto/md5" // #nosec
"embed"
Copy link
Member

Choose a reason for hiding this comment

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

i think the idea is to embed the schema into the tool's binary so the schema become optional at runtime, but you can still provide your schema if you want to otherwise it will use the embedded version.
Would this PR break that logic?

Copy link
Author

@san127127 san127127 Mar 26, 2025

Choose a reason for hiding this comment

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

@yiminc
I just gave it a try.
I found that actually embedded schema cannot not be used in windows because the embed filesystem uses "/" while the allowed values of the --schema-name cli option uses "\" on windows (it comes from filepath.Dir(path))

It gives this error on windows

Config Error:(-schema-name) must be one of: [mysql\\v8\\temporal mysql\\v8\\visibility postgresql\\v12\\temporal postgresql\\v12\\visibility]

And using update-schema -s mysql\\v8\\temporal when run into another error.

Do you want to the include a fix for this as well in the PR?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we should fix that, I think we want to keep the embed schema working.

Copy link
Author

@san127127 san127127 Mar 29, 2025

Choose a reason for hiding this comment

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

@yiminc
Fixed in embed.go
I updated the readme as well. TBH I didn't know the schema is embedded until you told me, and it looks isn't documented.

@san127127 san127127 force-pushed the fix-sql-tool-error-on-windows branch 2 times, most recently from ff9f308 to 75bee09 Compare March 29, 2025 02:46
@san127127 san127127 force-pushed the fix-sql-tool-error-on-windows branch from 75bee09 to 7c7f69f Compare March 29, 2025 02:47
@san127127 san127127 changed the title Fix sql error in windows Fix sql tools error in windows Mar 29, 2025
@san127127 san127127 changed the title Fix sql tools error in windows Fix sql tool error in windows Mar 29, 2025
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