ariga / atlas

Manage your database schema as code
https://atlasgo.io
Apache License 2.0
5.76k stars 260 forks source link

Windows parsing error during "migrate diff" #1528

Open andre-bisa opened 1 year ago

andre-bisa commented 1 year ago

In Windows there is an error running: atlas migrate diff command.

This is an example: image It seems it understands the column after C:/ as an hostname:port

rotemtam commented 1 year ago

Hey @andre-bisa

Thanks for reaching out. Can you share your entire env block in the atlas.hcl file? (Credential redacted, of course)

andre-bisa commented 1 year ago

Hey @rotemtam , I was just having a check with the simplest atlas.hcl possible. Here the screenshot image

Thanks

rotemtam commented 1 year ago

Thanks @andre-bisa , I will look into it.

Can you check in the meantime if you get an error with these values for "src":

andre-bisa commented 1 year ago

I'm having the same issue with migrations, in which I have a configuration similar to the one you asked to test: image

And here the error: image

@rotemtam

andre-bisa commented 1 year ago

@rotemtam I checked the code and it seems related to url.Parse() function of net/url (like this one: https://github.com/ariga/atlas/blob/master/cmd/atlas/internal/cmdapi/project.go#L238)

I found out some examples here that could solve the issue for Windows: https://go.dev/play/p/QuBFiU_1b1 But I have no idea on how to integrate those changes, I'm not a Go expert

NathanBaulch commented 3 months ago

I'm facing the same issue when running the Terraform provider on Windows. This is due to the way file:// URLs are built and passed to the --config flag - back slashes need to be converted to forward slashes on Windows before prepending file://.