-
Notifications
You must be signed in to change notification settings - Fork 1.4k
WIP: create sqlx.toml
format
#3383
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
base: main
Are you sure you want to change the base?
Conversation
2b7fdba
to
46dd260
Compare
fd557ad
to
6c886f8
Compare
af39902
to
b67a83b
Compare
496f631
to
6cc3ac0
Compare
6cc3ac0
to
3e812b6
Compare
copying idea from another issue #3738 to here: it would be nice to configure where DATABASE_URL and prepared queries is coming from. For example: sqlx.conf (root) root = true # or just find workspace root i guess
[macro.cache.foo]
database_url = { source = "dotenv", path = ".env", key = "DATABASE_URL" }
dir = "path_to_cache_folder" sqlx.toml (projectA) [macro]
database = { source = "dotenv", path = ".env", key = "DATABASE_URL" } sqlx.toml (projectB) [macro]
database = { source = "url", value = "postgres://..." } sqlx.toml (projectC) [macro]
database = { source = "cache", key = "foo" } |
# Conflicts: # sqlx-cli/src/lib.rs # sqlx-cli/src/opt.rs
"optional sqlx feature `{feature_gate}` required for type {param_ty} of param #{param_num}", | ||
) | ||
} else { | ||
format!("unsupported type {param_ty} for param #{param_num}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same confusing wording that already existed. I need to fix this.
Reference
sqlx.toml
: https://github.com/launchbadge/sqlx/blob/sqlx-toml/sqlx-core/src/config/reference.tomlOnce this is implemented, I'm planning on starting an alpha release cycle for 0.9.0 so that we can test this. It's not expected to be a breaking change but it's a large enough feature that it should probably go in a new major release, and there's a few other breaking API changes waiting in the wings.
The keys listed here are just the ones I've identified as needed for an MVP. Other keys may be added later backwards-compatibly.
Bikeshedding checklist:
snake_case
orkebab-case
for keys?macros.column_overrides
should maybe be calledmacros.table_overrides
instead?Implementation checklist
[common]
database-url-var
sqlx-cli
[macros]
preferred-crates
date-time
numeric
table-overrides
type-overrides
[migrate]
create-schemas
migrate!()
sqlx-cli
examples/postgres/multi-tenant
)table-name
migrate!()
sqlx-cli
examples/postgres/multi-tenant
)migrations-dir
migrate!()
#[sqlx::test]
?sqlx-cli
examples/postgres/multi-tenant
)ignored-chars
migrate!()
sqlx-cli
defaults
migration-type
migration-versioning
closes #121
closes #916
closes #3412