Skip to content

feat: add CockroachDB database adapter#1876

Merged
bpamiri merged 1 commit intodevelopfrom
feature/cockroachdb-adapter
Feb 13, 2026
Merged

feat: add CockroachDB database adapter#1876
bpamiri merged 1 commit intodevelopfrom
feature/cockroachdb-adapter

Conversation

@bpamiri
Copy link
Collaborator

@bpamiri bpamiri commented Feb 13, 2026

Summary

  • Adds a dedicated CockroachDB database adapter that extends the PostgreSQL adapter
  • CockroachDB uses the PostgreSQL wire protocol but enforces strict type checking — the PostgreSQL adapter maps boolean columns to cf_sql_bit, which causes unsupported comparison operator: <boolean> = <integer> errors on CockroachDB
  • The CockroachDB adapter overrides $getType() to map bool/boolean to cf_sql_boolean, which the JDBC driver correctly sends as a native boolean parameter
  • Detection uses database_productname (which CockroachDB reports as "CockroachDB") before the PostgreSQL driver_name check, since CockroachDB uses the standard PostgreSQL JDBC driver

Changes

  • New: databaseAdapters/CockroachDB/CockroachDBModel.cfc — extends PostgreSQLModel, overrides boolean type mapping
  • New: databaseAdapters/CockroachDB/CockroachDBMigrator.cfc — extends PostgreSQLMigrator
  • Modified: Model.cfc — adds CockroachDB detection before PostgreSQL check
  • Modified: migrator/Base.cfc — adds CockroachDB detection for migrations
  • Modified: migrator/Migration.cfc — updates supported database list in error message

Test plan

  • Verify CockroachDB is detected correctly when using the PostgreSQL JDBC driver (database_productname = "CockroachDB")
  • Verify boolean columns use cf_sql_boolean parameter type, resolving strict type comparison errors
  • Verify existing PostgreSQL databases continue to use the PostgreSQL adapter unchanged
  • Verify migrations work with CockroachDB via the extended migrator

🤖 Generated with Claude Code

CockroachDB uses the PostgreSQL wire protocol but enforces strict type
checking that rejects boolean-to-bit/integer comparisons. The PostgreSQL
adapter maps boolean columns to cf_sql_bit, which causes
"unsupported comparison operator: <boolean> = <integer>" errors on
CockroachDB.

- Add CockroachDB adapter extending PostgreSQL adapter, mapping
  bool/boolean types to cf_sql_boolean instead of cf_sql_bit
- Add CockroachDB migrator extending PostgreSQL migrator
- Detect CockroachDB via database_productname before the PostgreSQL
  driver_name check (since CockroachDB uses the PostgreSQL JDBC driver)
- Update supported database list in error messages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bpamiri bpamiri merged commit db0dd3e into develop Feb 13, 2026
43 checks passed
@bpamiri bpamiri deleted the feature/cockroachdb-adapter branch February 13, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments