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

Make sqlite3 db path relative to sqlboiler config file #1407

Closed
kelzenberg opened this issue Aug 6, 2024 · 3 comments
Closed

Make sqlite3 db path relative to sqlboiler config file #1407

kelzenberg opened this issue Aug 6, 2024 · 3 comments

Comments

@kelzenberg
Copy link

Having a Go project with a file structure like the following is problematic when using absolute or relative paths as suggested for the sqlite3 database in the sqlboiler config.

| project/
| -- cmd/
| ---- main.go
| -- db/
| ---- sqlite.db
| -- sqlboiler.toml
| -- go.mod

sqlboiler.toml

[sqlite3]
dbname = "db/sqlite.db"

The generation command works fine if ran in root ✅

sqlboiler --config ./sqlboiler.toml --output ./models sqlite3

The path-adjusted Go generate command in main.go will fail ❌

//go:generate sqlboiler --config ../sqlboiler.toml --output ../models sqlite3

The sqlite3 driver is not capable of finding the database sqlite.db as relative paths don't match. The problem can be solved by (optionally) resolving the sqlite3 database' path relative to the sqlboiler config, not the execution context.

@stephenafamo
Copy link
Collaborator

While this makes sense, this would be a breaking change so I wouldn't want to make the change because we won't be able to merge it before a future v5

@kelzenberg
Copy link
Author

Appreciate the answer. Would you put it in the backlog for a v5 please?

@stephenafamo
Copy link
Collaborator

Appreciate the answer. Would you put it in the backlog for a v5 please?

Sure. Although, I'm not really keeping track of them right now.
Perhaps if you send in a PR, I could mark it as "breaking" and leave it unmerged for now.

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

No branches or pull requests

2 participants