Open aemadrid-twx opened 2 years ago
Could you share your CockroachDB version and your rails database configuration (or URL) you used to connect?
Cockroach V22.1.4
default: &default
adapter: cockroachdb
encoding: utf8
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: some_app_development
host: localhost
port: 26257
user: root
password: ""
sslmode: disable
BTW tested this in a Rails 6 app with the 6.1.10 adapter and it works as expected.
❯ bundle exec rake db:create
Created database 'some_app_development'
Created database 'some_app_test'
❯ ruby -v
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [arm64-darwin21]
❯ bundle show rails
/Users/some_user/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/gems/rails-6.1.6.1
❯ bundle show activerecord-cockroachdb-adapter
/Users/some_user/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/gems/activerecord-cockroachdb-adapter-6.1.10
I haven't been able to reproduce this. If possible, could you upload your code to a repo or a gist so i can try running it myself?
The unrecognized configuration parameter "crdb_version"
error makes me think that it's somehow connecting to Postgres instead of CRDB.
I'm having the same issue with Rails 7.
$ bundle exec rake db:create
PG::UndefinedObject: ERROR: unrecognized configuration parameter "crdb_version"
Couldn't create 'defaultdb' database. Please check your configuration.
Using gem "activerecord-cockroachdb-adapter", "~> 7.0.0"
in Gemfile
database.yml
default: &default
adapter: cockroachdb
url: <%= ENV['ADAMSGPT_COCKROACHDB_DATABASE_URL'] %>
database: defaultdb
sslrootcert: './.postgresql/root.crt'
sslmode: verify-full
development:
<<: *default
production:
<<: *default
bundle show activerecord-cockroachdb-adapter
/Users/adamgrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activerecord-cockroachdb-adapter-7.0.0
bundle show rails
/Users/adamgrant/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rails-7.0.4.3
ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin22]
Strangely I ran it again today and it worked just fine. 🤷🏻