Skip to content

Fix CockroachDB primary key: use unique_rowid() instead of SERIAL#1986

Merged
bpamiri merged 1 commit intodevelopfrom
peter/1970-cockroachdb-primary-key
Mar 17, 2026
Merged

Fix CockroachDB primary key: use unique_rowid() instead of SERIAL#1986
bpamiri merged 1 commit intodevelopfrom
peter/1970-cockroachdb-primary-key

Conversation

@bpamiri
Copy link
Collaborator

@bpamiri bpamiri commented Mar 16, 2026

Summary

  • CockroachDBMigrator inherits PostgreSQL's addPrimaryKeyOptions() which replaces INTEGER with SERIAL -- a type CockroachDB does not support
  • Adds an override in CockroachDBMigrator.cfc that uses INT DEFAULT unique_rowid() instead, which is CockroachDB's idiomatic auto-generated primary key pattern

Fixes #1970

Test plan

  • Run migrations against a CockroachDB instance and verify CREATE TABLE statements use INT DEFAULT unique_rowid() PRIMARY KEY instead of SERIAL PRIMARY KEY
  • Verify PostgreSQL migrations are unaffected (still use SERIAL)

🤖 Generated with Claude Code

…f SERIAL

CockroachDB does not support PostgreSQL's SERIAL type. Override
addPrimaryKeyOptions in CockroachDBMigrator to use INT DEFAULT unique_rowid()
for auto-increment primary keys.

Fixes #1970

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

Wheels Test Matrix

Engine MySQL PostgreSQL SQL Server H2 Oracle SQLite
lucee5
lucee6
lucee7
adobe2018 -- --
adobe2021 --
adobe2023 --
adobe2025 --
boxlang --

Results for commit e44210c.

@github-actions
Copy link
Contributor

Wheels Test Results

    42 files  ±0   3 906 suites  ±0   25m 12s ⏱️ -24s
79 512 tests ±0  79 124 ✅ ±0  388 💤 ±0  0 ❌ ±0 
82 158 runs  ±0  81 770 ✅ ±0  388 💤 ±0  0 ❌ ±0 

Results for commit 5bbe585. ± Comparison against base commit e57ecf8.

@bpamiri bpamiri merged commit 63a6bdc into develop Mar 17, 2026
12 checks passed
@bpamiri bpamiri deleted the peter/1970-cockroachdb-primary-key branch March 17, 2026 22:32
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.

CockroachDB: addPrimaryKeyOptions uses SERIAL (unsupported)

1 participant