feat: CockroachDB Support
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 734
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
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: https://github.com/SeaQL/sea-orm/pull/2930
- SeaQuery: https://github.com/SeaQL/sea-query/pull/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?;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the linked SeaORM pull request 2930 and SeaQuery pull request 1048 first, then compare their changes with the implementation-status checklist and feature flags in this issue. The work is done when the listed CockroachDB backend, identity-column handling, URL support, documentation, and tests are complete in both projects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, rust
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 15/100