Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 7 version throws "PG::UndefinedObject" #257

Open
aemadrid-twx opened this issue Jul 22, 2022 · 7 comments
Open

Rails 7 version throws "PG::UndefinedObject" #257

aemadrid-twx opened this issue Jul 22, 2022 · 7 comments
Assignees

Comments

@aemadrid-twx
Copy link

❯ bundle show activerecord-cockroachdb-adapter
/Users/some_user/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/gems/activerecord-cockroachdb-adapter-7.0.0

❯ bundle show rails
/Users/some_user/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/gems/rails-7.0.3.1

❯ ruby -v
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [arm64-darwin21]

❯  be rake db:create
Created database 'some_app_development'
PG::UndefinedObject: ERROR:  unrecognized configuration parameter "crdb_version"
Couldn't create 'some_app_development' database. Please check your configuration.
rake aborted!
ActiveRecord::ConnectionNotEstablished: PG::UndefinedObject: ERROR:  unrecognized configuration parameter "crdb_version"
/Users/some_user/.asdf/installs/ruby/3.1.1/bin/bundle:25:in `load'
/Users/some_user/.asdf/installs/ruby/3.1.1/bin/bundle:25:in `<main>'
@rafiss
Copy link
Contributor

rafiss commented Jul 22, 2022

Could you share your CockroachDB version and your rails database configuration (or URL) you used to connect?

@aemadrid-twx
Copy link
Author

aemadrid-twx commented Jul 22, 2022

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

@aemadrid-twx
Copy link
Author

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

@rafiss
Copy link
Contributor

rafiss commented Aug 4, 2022

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.

@rimadeodhar rimadeodhar self-assigned this Sep 27, 2022
@adamjgrant
Copy link

adamjgrant commented Mar 19, 2023

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

@adamjgrant
Copy link

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]

@adamjgrant
Copy link

Strangely I ran it again today and it worked just fine. 🤷🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants