# ch-database
`ch-database` provides database lifecycle, migration, and object-storage
primitives behind independent feature flags.
More information is available in the
[API documentation](https://docs.rs/ch-database).
## High-level features
- SQLx pool configuration, URL handling, retries, migrations, and health checks
- SpacetimeDB connection lifecycle and serialized subscriptions
- Local and S3-compatible object storage through a common API
- Redacted diagnostics for connection strings and credentials
- Application-owned schemas, account models, and authorization policy
## Feature flags
| `mariadb` | SQLx pool settings, URL handling, migrations, and health checks; enabled by default |
| `spacetimedb` | Connection lifecycle, serialized subscriptions, endpoint state, and read-failure handling |
| `s3` | Local filesystem and S3-compatible object storage |
## Usage
```rust
use ch_database::mariadb::url::normalize_mysql_url;
fn main() -> anyhow::Result<()> {
let url = normalize_mysql_url("mysql://user:pass@localhost/example")?;
assert!(url.starts_with("mysql://"));
Ok(())
}
```
With `s3` enabled, `ObjectStoreClient` supports local directories, Amazon S3,
MinIO, and compatible endpoints. Object keys reject path traversal, absolute
paths, and ambiguous separators. Buffered reads have a 64 MiB default limit;
`get_object` exposes a streaming result for larger objects.
## Minimum supported Rust version
`ch-database` requires Rust 1.99 or newer.
## License
Licensed under the Sustainable Use License 1.0. See
[`LICENSE.md`](LICENSE.md).