-
-
Notifications
You must be signed in to change notification settings - Fork 661
Open
Description
Summary
This issue tracks the implementation of CockroachDB support for SeaORM.
CockroachDB is wire-compatible with PostgreSQL, so most functionality works with the existing sqlx-postgres driver. The main difference is schema generation: CockroachDB doesn't support PostgreSQL's SERIAL columns and requires GENERATED BY DEFAULT AS IDENTITY instead.
Related PRs
- SeaORM: feat: Add CockroachDB support #2930
- SeaQuery: feat: Add CockroachDB backend support sea-query#1048
Implementation Status
SeaORM
- Added DatabaseBackend::Cockroach variant
- Added cockroachdb feature flag
- Added URL scheme handling (cockroachdb://, postgres://, postgresql://)
- Added schema generation for IDENTITY columns
- Added documentation
- Added tests
SeaQuery
- Added backend-cockroach feature flag
- Added CockroachQueryBuilder as alias to PostgresQueryBuilder
- Added option-cockroachdb-use-identity feature flag
- Updated version to 1.0.0-rc.29
Feature Flags
| Package | Feature | Description |
|---|---|---|
| sea-orm | cockroachdb | Enable CockroachDB support |
| sea-orm | cockroachdb-use-identity-pk | Use IDENTITY columns for primary keys |
| sea-query | backend-cockroach | Enable CockroachDB backend |
| sea-query | option-cockroachdb-use-identity | Use IDENTITY columns (reserved) |
Usage Example
Cargo
# Cargo.toml
[dependencies]
sea-orm = { version = "2.0", features = ["cockroachdb", "runtime-tokio-native-tls"] }Rust Code
let db: DbConn = sea_orm::Connect::connect("postgres://user:password@host:26257/database?sslmode=require")
.await?;Metadata
Metadata
Assignees
Labels
No labels