mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
* feat: create `sqlx.toml` format * feat: add support for ignored_chars config to sqlx_core::migrate * chore: test ignored_chars with `U+FEFF` (ZWNBSP/BOM) https://en.wikipedia.org/wiki/Byte_order_mark * refactor: make `Config` always compiled simplifies usage while still making parsing optional for less generated code * refactor: add origin information to `Column` * feat(macros): implement `type_override` and `column_override` from `sqlx.toml` * refactor(sqlx.toml): make all keys kebab-case, create `macros.preferred-crates` * feat: make macros aware of `macros.preferred-crates` * feat: make `sqlx-cli` aware of `database-url-var` * feat: teach macros about `migrate.table-name`, `migrations-dir` * feat: teach macros about `migrate.ignored-chars` * chore: delete unused source file `sqlx-cli/src/migration.rs` * feat: teach `sqlx-cli` about `migrate.defaults` * feat: teach `sqlx-cli` about `migrate.migrations-dir` * feat: teach `sqlx-cli` about `migrate.table-name` * feat: introduce `migrate.create-schemas` * WIP feat: create multi-tenant database example * fix(postgres): don't fetch `ColumnOrigin` for transparently-prepared statements * feat: progress on axum-multi-tenant example * feat(config): better errors for mislabeled fields * WIP feat: filling out axum-multi-tenant example * feat: multi-tenant example No longer Axum-based because filling out the request routes would have distracted from the purpose of the example. * chore(ci): test multi-tenant example * fixup after merge * fix(ci): enable `sqlx-toml` in CLI build for examples * fix: CI, README for `multi-tenant` * fix: clippy warnings * fix: multi-tenant README * fix: sequential versioning inference for migrations * fix: migration versioning with explicit overrides * fix: only warn on ambiguous crates if the invocation relies on it * fix: remove unused imports * fix: doctest * fix: `sqlx mig add` behavior and tests * fix: restore original type-checking order * fix: deprecation warning in `tests/postgres/macros.rs` * feat: create postgres/multi-database example * fix: examples/postgres/multi-database * fix: cargo fmt * chore: add tests for config `migrate.defaults` * fix: sqlx-cli/tests/add.rs * feat(cli): add `--config` override to all relevant commands * chore: run `sqlx mig add` test with `RUST_BACKTRACE=1` * fix: properly canonicalize config path for `sqlx mig add` test * fix: get `sqlx mig add` test passing * fix(cli): test `migrate.ignored-chars`, fix bugs * feat: create `macros.preferred-crates` example * fix(examples): use workspace `sqlx` * fix: examples * fix(sqlite): unexpected feature flags in `type_checking.rs` * fix: run `cargo fmt` * fix: more example fixes * fix(ci): preferred-crates setup * fix(examples): enable default-features for workspace `sqlx` * fix(examples): issues in `preferred-crates` * chore: adjust error message for missing param type in `query!()` * doc: mention new `sqlx.toml` configuration * chore: add `CHANGELOG` entry Normally I generate these when cutting the release, but I wanted to take time to editorialize this one. * doc: fix new example titles * refactor: make `sqlx-toml` feature non-default, improve errors * refactor: eliminate panics in `Config` read path * chore: remove unused `axum` dependency from new examples * fix(config): restore fallback to default config for macros * chore(config): remove use of `once_cell` (to match `main`)
409 lines
11 KiB
TOML
409 lines
11 KiB
TOML
[workspace]
|
|
members = [
|
|
".",
|
|
"sqlx-core",
|
|
"sqlx-macros",
|
|
"sqlx-macros-core",
|
|
"sqlx-test",
|
|
"sqlx-cli",
|
|
# "sqlx-bench",
|
|
"sqlx-mysql",
|
|
"sqlx-postgres",
|
|
"sqlx-sqlite",
|
|
"examples/mysql/todos",
|
|
"examples/postgres/axum-social-with-tests",
|
|
"examples/postgres/chat",
|
|
"examples/postgres/files",
|
|
"examples/postgres/json",
|
|
"examples/postgres/listen",
|
|
"examples/postgres/mockable-todos",
|
|
"examples/postgres/multi-database",
|
|
"examples/postgres/multi-tenant",
|
|
"examples/postgres/preferred-crates",
|
|
"examples/postgres/todos",
|
|
"examples/postgres/transaction",
|
|
"examples/sqlite/todos",
|
|
]
|
|
|
|
[workspace.package]
|
|
version = "0.9.0-alpha.1"
|
|
license = "MIT OR Apache-2.0"
|
|
# TODO: upgrade to edition 2024 (after merging all pending PRs)
|
|
edition = "2021"
|
|
repository = "https://github.com/launchbadge/sqlx"
|
|
keywords = ["database", "async", "postgres", "mysql", "sqlite"]
|
|
categories = ["database", "asynchronous"]
|
|
authors = [
|
|
"Ryan Leckey <leckey.ryan@gmail.com>",
|
|
"Austin Bonander <austin.bonander@gmail.com>",
|
|
"Chloe Ross <orangesnowfox@gmail.com>",
|
|
"Daniel Akhterov <akhterovd@gmail.com>",
|
|
]
|
|
rust-version = "1.86.0"
|
|
|
|
[package]
|
|
name = "sqlx"
|
|
readme = "README.md"
|
|
documentation = "https://docs.rs/sqlx"
|
|
description = "🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite."
|
|
version.workspace = true
|
|
license.workspace = true
|
|
edition.workspace = true
|
|
authors.workspace = true
|
|
repository.workspace = true
|
|
rust-version.workspace = true
|
|
|
|
[package.metadata.docs.rs]
|
|
features = ["all-databases", "_unstable-all-types", "_unstable-doc", "sqlite-preupdate-hook"]
|
|
rustdoc-args = ["--cfg", "docsrs"]
|
|
|
|
[features]
|
|
default = ["any", "macros", "migrate", "json"]
|
|
|
|
derive = ["sqlx-macros/derive"]
|
|
macros = ["derive", "sqlx-macros/macros"]
|
|
migrate = ["sqlx-core/migrate", "sqlx-macros?/migrate", "sqlx-mysql?/migrate", "sqlx-postgres?/migrate", "sqlx-sqlite?/migrate"]
|
|
|
|
# Enable parsing of `sqlx.toml` for configuring macros and migrations.
|
|
sqlx-toml = ["sqlx-core/sqlx-toml", "sqlx-macros?/sqlx-toml"]
|
|
|
|
# intended mainly for CI and docs
|
|
all-databases = ["mysql", "sqlite", "postgres", "any"]
|
|
_unstable-all-types = [
|
|
"bigdecimal",
|
|
"rust_decimal",
|
|
"json",
|
|
"time",
|
|
"chrono",
|
|
"ipnet",
|
|
"ipnetwork",
|
|
"mac_address",
|
|
"uuid",
|
|
"bit-vec",
|
|
"bstr"
|
|
]
|
|
# Render documentation that wouldn't otherwise be shown (e.g. `sqlx_core::config`).
|
|
_unstable-doc = []
|
|
|
|
# Base runtime features without TLS
|
|
runtime-async-std = ["_rt-async-std", "sqlx-core/_rt-async-std", "sqlx-macros?/_rt-async-std"]
|
|
runtime-tokio = ["_rt-tokio", "sqlx-core/_rt-tokio", "sqlx-macros?/_rt-tokio"]
|
|
|
|
# TLS features
|
|
tls-native-tls = ["sqlx-core/_tls-native-tls", "sqlx-macros?/_tls-native-tls"]
|
|
tls-rustls = ["tls-rustls-ring"] # For backwards compatibility
|
|
tls-rustls-aws-lc-rs = ["sqlx-core/_tls-rustls-aws-lc-rs", "sqlx-macros?/_tls-rustls-aws-lc-rs"]
|
|
tls-rustls-ring = ["tls-rustls-ring-webpki"] # For backwards compatibility
|
|
tls-rustls-ring-webpki = ["sqlx-core/_tls-rustls-ring-webpki", "sqlx-macros?/_tls-rustls-ring-webpki"]
|
|
tls-rustls-ring-native-roots = ["sqlx-core/_tls-rustls-ring-native-roots", "sqlx-macros?/_tls-rustls-ring-native-roots"]
|
|
|
|
# No-op feature used by the workflows to compile without TLS enabled. Not meant for general use.
|
|
tls-none = []
|
|
|
|
# for conditional compilation
|
|
_rt-async-std = []
|
|
_rt-tokio = []
|
|
_sqlite = []
|
|
|
|
# database
|
|
any = ["sqlx-core/any", "sqlx-mysql?/any", "sqlx-postgres?/any", "sqlx-sqlite?/any"]
|
|
postgres = ["sqlx-postgres", "sqlx-macros?/postgres"]
|
|
mysql = ["sqlx-mysql", "sqlx-macros?/mysql"]
|
|
sqlite = ["_sqlite", "sqlx-sqlite/bundled", "sqlx-macros?/sqlite"]
|
|
sqlite-unbundled = ["_sqlite", "sqlx-sqlite/unbundled", "sqlx-macros?/sqlite-unbundled"]
|
|
sqlite-preupdate-hook = ["sqlx-sqlite/preupdate-hook"]
|
|
|
|
# types
|
|
json = ["sqlx-core/json", "sqlx-macros?/json", "sqlx-mysql?/json", "sqlx-postgres?/json", "sqlx-sqlite?/json"]
|
|
|
|
bigdecimal = ["sqlx-core/bigdecimal", "sqlx-macros?/bigdecimal", "sqlx-mysql?/bigdecimal", "sqlx-postgres?/bigdecimal"]
|
|
bit-vec = ["sqlx-core/bit-vec", "sqlx-macros?/bit-vec", "sqlx-postgres?/bit-vec"]
|
|
chrono = ["sqlx-core/chrono", "sqlx-macros?/chrono", "sqlx-mysql?/chrono", "sqlx-postgres?/chrono", "sqlx-sqlite?/chrono"]
|
|
ipnet = ["sqlx-core/ipnet", "sqlx-macros?/ipnet", "sqlx-postgres?/ipnet"]
|
|
ipnetwork = ["sqlx-core/ipnetwork", "sqlx-macros?/ipnetwork", "sqlx-postgres?/ipnetwork"]
|
|
mac_address = ["sqlx-core/mac_address", "sqlx-macros?/mac_address", "sqlx-postgres?/mac_address"]
|
|
rust_decimal = ["sqlx-core/rust_decimal", "sqlx-macros?/rust_decimal", "sqlx-mysql?/rust_decimal", "sqlx-postgres?/rust_decimal"]
|
|
time = ["sqlx-core/time", "sqlx-macros?/time", "sqlx-mysql?/time", "sqlx-postgres?/time", "sqlx-sqlite?/time"]
|
|
uuid = ["sqlx-core/uuid", "sqlx-macros?/uuid", "sqlx-mysql?/uuid", "sqlx-postgres?/uuid", "sqlx-sqlite?/uuid"]
|
|
regexp = ["sqlx-sqlite?/regexp"]
|
|
bstr = ["sqlx-core/bstr"]
|
|
|
|
[workspace.dependencies]
|
|
# Core Crates
|
|
sqlx-core = { version = "=0.9.0-alpha.1", path = "sqlx-core" }
|
|
sqlx-macros-core = { version = "=0.9.0-alpha.1", path = "sqlx-macros-core" }
|
|
sqlx-macros = { version = "=0.9.0-alpha.1", path = "sqlx-macros" }
|
|
|
|
# Driver crates
|
|
sqlx-mysql = { version = "=0.9.0-alpha.1", path = "sqlx-mysql" }
|
|
sqlx-postgres = { version = "=0.9.0-alpha.1", path = "sqlx-postgres" }
|
|
sqlx-sqlite = { version = "=0.9.0-alpha.1", path = "sqlx-sqlite" }
|
|
|
|
# Facade crate (for reference from sqlx-cli)
|
|
sqlx = { version = "=0.9.0-alpha.1", path = "." }
|
|
|
|
# Common type integrations shared by multiple driver crates.
|
|
# These are optional unless enabled in a workspace crate.
|
|
bigdecimal = "0.4.0"
|
|
bit-vec = "0.6.3"
|
|
chrono = { version = "0.4.34", default-features = false, features = ["std", "clock"] }
|
|
ipnet = "2.3.0"
|
|
ipnetwork = "0.20.0"
|
|
mac_address = "1.1.5"
|
|
rust_decimal = { version = "1.26.1", default-features = false, features = ["std"] }
|
|
time = { version = "0.3.36", features = ["formatting", "parsing", "macros"] }
|
|
uuid = "1.1.2"
|
|
|
|
# Common utility crates
|
|
dotenvy = { version = "0.15.7", default-features = false }
|
|
|
|
# Runtimes
|
|
[workspace.dependencies.async-std]
|
|
version = "1.12"
|
|
|
|
[workspace.dependencies.tokio]
|
|
version = "1"
|
|
features = ["time", "net", "sync", "fs", "io-util", "rt"]
|
|
default-features = false
|
|
|
|
[dependencies]
|
|
sqlx-core = { workspace = true, features = ["offline", "migrate"] }
|
|
sqlx-macros = { workspace = true, optional = true }
|
|
|
|
sqlx-mysql = { workspace = true, optional = true }
|
|
sqlx-postgres = { workspace = true, optional = true }
|
|
sqlx-sqlite = { workspace = true, optional = true }
|
|
|
|
[dev-dependencies]
|
|
anyhow = "1.0.52"
|
|
time_ = { version = "0.3.2", package = "time" }
|
|
futures-util = { version = "0.3.19", default-features = false, features = ["alloc"] }
|
|
env_logger = "0.11"
|
|
async-std = { workspace = true, features = ["attributes"] }
|
|
tokio = { version = "1.15.0", features = ["full"] }
|
|
dotenvy = "0.15.0"
|
|
trybuild = "1.0.53"
|
|
sqlx-test = { path = "./sqlx-test" }
|
|
paste = "1.0.6"
|
|
serde = { version = "1.0.132", features = ["derive"] }
|
|
serde_json = "1.0.73"
|
|
url = "2.2.2"
|
|
rand = "0.8.4"
|
|
rand_xoshiro = "0.6.0"
|
|
hex = "0.4.3"
|
|
tempfile = "3.10.1"
|
|
criterion = { version = "0.5.1", features = ["async_tokio"] }
|
|
libsqlite3-sys = { version = "0.30.1" }
|
|
|
|
# If this is an unconditional dev-dependency then Cargo will *always* try to build `libsqlite3-sys`,
|
|
# even when SQLite isn't the intended test target, and fail if the build environment is not set up for compiling C code.
|
|
[target.'cfg(sqlite_test_sqlcipher)'.dev-dependencies]
|
|
# Enable testing with SQLCipher if specifically requested.
|
|
libsqlite3-sys = { version = "0.30.1", features = ["bundled-sqlcipher"] }
|
|
|
|
# Common lint settings for the workspace
|
|
[workspace.lints.clippy]
|
|
# https://github.com/launchbadge/sqlx/issues/3440
|
|
cast_possible_truncation = 'deny'
|
|
cast_possible_wrap = 'deny'
|
|
cast_sign_loss = 'deny'
|
|
# See `clippy.toml`
|
|
disallowed_methods = 'deny'
|
|
|
|
#
|
|
# Any
|
|
#
|
|
|
|
[[test]]
|
|
name = "any"
|
|
path = "tests/any/any.rs"
|
|
required-features = ["any"]
|
|
|
|
[[test]]
|
|
name = "any-pool"
|
|
path = "tests/any/pool.rs"
|
|
required-features = ["any"]
|
|
|
|
#
|
|
# Migrations
|
|
#
|
|
|
|
[[test]]
|
|
name = "migrate-macro"
|
|
path = "tests/migrate/macro.rs"
|
|
required-features = ["macros", "migrate"]
|
|
|
|
#
|
|
# SQLite
|
|
#
|
|
|
|
[[test]]
|
|
name = "sqlite"
|
|
path = "tests/sqlite/sqlite.rs"
|
|
required-features = ["sqlite"]
|
|
|
|
[[test]]
|
|
name = "sqlite-any"
|
|
path = "tests/sqlite/any.rs"
|
|
required-features = ["sqlite"]
|
|
|
|
[[test]]
|
|
name = "sqlite-types"
|
|
path = "tests/sqlite/types.rs"
|
|
required-features = ["sqlite"]
|
|
|
|
[[test]]
|
|
name = "sqlite-describe"
|
|
path = "tests/sqlite/describe.rs"
|
|
required-features = ["sqlite"]
|
|
|
|
[[test]]
|
|
name = "sqlite-macros"
|
|
path = "tests/sqlite/macros.rs"
|
|
required-features = ["sqlite", "macros"]
|
|
|
|
[[test]]
|
|
name = "sqlite-unbundled-macros"
|
|
path = "tests/sqlite/macros.rs"
|
|
required-features = ["sqlite-unbundled", "macros"]
|
|
|
|
[[test]]
|
|
name = "sqlite-derives"
|
|
path = "tests/sqlite/derives.rs"
|
|
required-features = ["sqlite", "macros"]
|
|
|
|
[[test]]
|
|
name = "sqlite-error"
|
|
path = "tests/sqlite/error.rs"
|
|
required-features = ["sqlite"]
|
|
|
|
[[test]]
|
|
name = "sqlite-sqlcipher"
|
|
path = "tests/sqlite/sqlcipher.rs"
|
|
required-features = ["sqlite"]
|
|
|
|
[[test]]
|
|
name = "sqlite-test-attr"
|
|
path = "tests/sqlite/test-attr.rs"
|
|
required-features = ["sqlite", "macros", "migrate"]
|
|
|
|
[[test]]
|
|
name = "sqlite-migrate"
|
|
path = "tests/sqlite/migrate.rs"
|
|
required-features = ["sqlite", "macros", "migrate"]
|
|
|
|
[[test]]
|
|
name = "sqlite-rustsec"
|
|
path = "tests/sqlite/rustsec.rs"
|
|
required-features = ["sqlite"]
|
|
|
|
[[bench]]
|
|
name = "sqlite-describe"
|
|
path = "benches/sqlite/describe.rs"
|
|
harness = false
|
|
required-features = ["sqlite"]
|
|
|
|
#
|
|
# MySQL
|
|
#
|
|
|
|
[[test]]
|
|
name = "mysql"
|
|
path = "tests/mysql/mysql.rs"
|
|
required-features = ["mysql"]
|
|
|
|
[[test]]
|
|
name = "mysql-types"
|
|
path = "tests/mysql/types.rs"
|
|
required-features = ["mysql"]
|
|
|
|
[[test]]
|
|
name = "mysql-describe"
|
|
path = "tests/mysql/describe.rs"
|
|
required-features = ["mysql"]
|
|
|
|
[[test]]
|
|
name = "mysql-derives"
|
|
path = "tests/mysql/derives.rs"
|
|
required-features = ["mysql", "derive"]
|
|
|
|
[[test]]
|
|
name = "mysql-macros"
|
|
path = "tests/mysql/macros.rs"
|
|
required-features = ["mysql", "macros"]
|
|
|
|
[[test]]
|
|
name = "mysql-error"
|
|
path = "tests/mysql/error.rs"
|
|
required-features = ["mysql"]
|
|
|
|
[[test]]
|
|
name = "mysql-test-attr"
|
|
path = "tests/mysql/test-attr.rs"
|
|
required-features = ["mysql", "macros", "migrate"]
|
|
|
|
[[test]]
|
|
name = "mysql-migrate"
|
|
path = "tests/mysql/migrate.rs"
|
|
required-features = ["mysql", "macros", "migrate"]
|
|
|
|
[[test]]
|
|
name = "mysql-rustsec"
|
|
path = "tests/mysql/rustsec.rs"
|
|
required-features = ["mysql"]
|
|
|
|
#
|
|
# PostgreSQL
|
|
#
|
|
|
|
[[test]]
|
|
name = "postgres"
|
|
path = "tests/postgres/postgres.rs"
|
|
required-features = ["postgres"]
|
|
|
|
[[test]]
|
|
name = "postgres-types"
|
|
path = "tests/postgres/types.rs"
|
|
required-features = ["postgres"]
|
|
|
|
[[test]]
|
|
name = "postgres-describe"
|
|
path = "tests/postgres/describe.rs"
|
|
required-features = ["postgres"]
|
|
|
|
[[test]]
|
|
name = "postgres-macros"
|
|
path = "tests/postgres/macros.rs"
|
|
required-features = ["postgres", "macros"]
|
|
|
|
[[test]]
|
|
name = "postgres-derives"
|
|
path = "tests/postgres/derives.rs"
|
|
required-features = ["postgres", "macros"]
|
|
|
|
[[test]]
|
|
name = "postgres-error"
|
|
path = "tests/postgres/error.rs"
|
|
required-features = ["postgres"]
|
|
|
|
[[test]]
|
|
name = "postgres-test-attr"
|
|
path = "tests/postgres/test-attr.rs"
|
|
required-features = ["postgres", "macros", "migrate"]
|
|
|
|
[[test]]
|
|
name = "postgres-migrate"
|
|
path = "tests/postgres/migrate.rs"
|
|
required-features = ["postgres", "macros", "migrate"]
|
|
|
|
|
|
[[test]]
|
|
name = "postgres-query-builder"
|
|
path = "tests/postgres/query_builder.rs"
|
|
required-features = ["postgres"]
|
|
|
|
[[test]]
|
|
name = "postgres-rustsec"
|
|
path = "tests/postgres/rustsec.rs"
|
|
required-features = ["postgres", "macros", "migrate"]
|