You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DatabaseCleaner treats CockroachDB as PostgreSQL (which makes sense because CockroachDB emulated PostgreSQL to some extent). It uses the RESTART IDENTITY clause in the TRUNCATE TABLE query, which isn't supported by CockroachDB. There should probably be separate handling for CockroachDB that doesn't use that clause, and perhaps runs a separate query to reset the auto-increment counter.
The text was updated successfully, but these errors were encountered:
Hi @agaffney, thanks for the issue. We don't currently support CockroachDB in this adapter, but I'm certainly open to supporting it in one way or another! The question is what that should look like. Does it look like adding support (code and tests) to this repo, or does it look like creating a new adapter for database_cleaner, or maybe even generalizing the code in this adapter to leverage AR's built-in abilities to abstract across various DBs? Thoughts?
I do not have a suggested course of action here. This is just something I ran into while testing moving a Rails app from PostgreSQL to CockroachDB.
I was able to work around the issue by manually removing the RESTART IDENTITY part of the query, but that seemed to cause some issues with our spec tests, because they expect the ID column's value to get reset between tests.
DatabaseCleaner treats CockroachDB as PostgreSQL (which makes sense because CockroachDB emulated PostgreSQL to some extent). It uses the
RESTART IDENTITY
clause in theTRUNCATE TABLE
query, which isn't supported by CockroachDB. There should probably be separate handling for CockroachDB that doesn't use that clause, and perhaps runs a separate query to reset the auto-increment counter.The text was updated successfully, but these errors were encountered: