jruby / activerecord-jdbc-adapter

JRuby's ActiveRecord adapter using JDBC.
BSD 2-Clause "Simplified" License
462 stars 385 forks source link

Error running db:migrate on JRuby 9.4.0 and rails 7.0.4 #1122

Closed hurricup closed 1 year ago

hurricup commented 1 year ago

When running rails db:migrate RAILS_ENV=test Getting:

rails aborted!
NoMethodError: undefined method `alias_method_chain' for #<Class:ActiveRecord::Base>
Did you mean?  alias_method
/home/user/.rvm/gems/jruby-9.4.0.0/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:13:in `singleton class'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:4:in `block in ActiveRecord'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:3:in `<module:ActiveRecord>'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:1:in `<main>'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/adapter.rb:6:in `<main>'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc.rb:52:in `<module:ArJdbc>'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc.rb:3:in `<main>'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc.rb:9:in `<main>'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/activerecord-jdbcsqlite3-adapter-1.3.22/lib/activerecord-jdbcsqlite3-adapter.rb:2:in `<main>'
/mnt/agent/temp/buildTmp/unitTest_Minitest_2IEv7hCEZw1WxRNhy8QXFjmB4Bu/config/application.rb:7:in `<main>'
/mnt/agent/temp/buildTmp/unitTest_Minitest_2IEv7hCEZw1WxRNhy8QXFjmB4Bu/Rakefile:4:in `<main>'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/railties-7.0.4/lib/rails/command.rb:51:in `invoke'
/home/user/.rvm/gems/jruby-9.4.0.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
/mnt/agent/temp/buildTmp/unitTest_Minitest_2IEv7hCEZw1WxRNhy8QXFjmB4Bu/bin/rails:4:in `<main>'
(See full trace by running task with --trace)
hurricup commented 1 year ago

I even has this when creating application with some settings:

/bin/bash -c "/usr/share/rvm/bin/rvm jruby-9.4.0.0@rails do /usr/share/rvm/rubies/jruby-9.4.0.0/bin/jruby /usr/share/rvm/gems/jruby-9.4.0.0@rails/bin/rails _7.0.4_ new /home/hurricup/Projects/untitled2 --javascript=importmap --skip --database=sqlite3"
Warning! PATH is not properly set up, /usr/share/rvm/gems/ruby-2.3.8/bin is not at first place.
         Usually this is caused by shell initialization files. Search for PATH=... entries.
         You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
         To fix it temporarily in this shell session run: rvm use ruby-2.3.8
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
       exist  
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  .gitattributes
      create  Gemfile
         run  git init from "."
Initialized empty Git repository in /home/hurricup/Projects/untitled2/.git/
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images
      create  app/assets/images/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/cable.yml
      create  config/puma.rb
      create  config/storage.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/content_security_policy.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/new_framework_defaults_7_0.rb
      create  config/initializers/permissions_policy.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/master.key
      append  .gitignore
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  tmp
      create  tmp/.keep
      create  tmp/pids
      create  tmp/pids/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor
      create  vendor/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/channels/application_cable/connection_test.rb
      create  test/test_helper.rb
      create  test/system
      create  test/system/.keep
      create  test/application_system_test_case.rb
      create  storage
      create  storage/.keep
      create  tmp/storage
      create  tmp/storage/.keep
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_7_0.rb
         run  bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies.................................................
Using rake 13.0.6
Using concurrent-ruby 1.1.10
Using erubi 1.11.0
Using builder 3.2.4
Using crass 1.0.6
Using rack 2.2.4
Using racc 1.6.0 (java)
Using websocket-extensions 0.1.5
Using mini_mime 1.1.2
Using nio4r 2.5.8 (java)
Using marcel 1.0.2
Using timeout 0.3.0
Using bundler 2.3.26
Using matrix 0.4.2
Using method_source 1.0.0
Using zeitwerk 2.6.6
Using thor 1.2.1
Using rexml 3.2.5
Fetching regexp_parser 2.6.1
Fetching jdbc-sqlite3 3.8.11.2
Fetching bindex 0.8.1
Fetching public_suffix 5.0.0
Fetching minitest 5.16.3
Fetching websocket 1.2.9
Fetching childprocess 4.1.0
Fetching sprockets 4.1.1
Fetching rubyzip 2.3.2
Using nokogiri 1.13.9 (java)
Using rack-test 2.0.2
Using i18n 1.12.0
Using tzinfo 2.0.5
Using mail 2.7.1
Using websocket-driver 0.7.5 (java)
Fetching puma 5.6.5 (java)
Fetching net-protocol 0.1.3
Using loofah 2.19.0
Fetching xpath 3.2.0
Fetching tzinfo-data 1.2022.7
Using rails-html-sanitizer 1.4.3
Installing net-protocol 0.1.3
Installing bindex 0.8.1 with native extensions
Installing websocket 1.2.9
Installing xpath 3.2.0
Installing childprocess 4.1.0
Installing rubyzip 2.3.2
Installing regexp_parser 2.6.1
Installing minitest 5.16.3
Installing sprockets 4.1.1
Installing public_suffix 5.0.0
Installing puma 5.6.5 (java)
Installing tzinfo-data 1.2022.7
Fetching net-imap 0.3.1
Fetching net-smtp 0.3.3
Fetching net-pop 0.1.2
Fetching selenium-webdriver 4.6.1
Using activesupport 7.0.4
Using rails-dom-testing 2.0.3
Using activemodel 7.0.4
Using globalid 1.0.0
Using actionview 7.0.4
Using activerecord 7.0.4
Using activejob 7.0.4
Using actionpack 7.0.4
Using railties 7.0.4
Fetching activerecord-jdbc-adapter 1.3.22
Fetching jbuilder 2.11.5
Using actioncable 7.0.4
Using activestorage 7.0.4
Fetching importmap-rails 1.1.5
Using actiontext 7.0.4
Fetching turbo-rails 1.3.2
Fetching addressable 2.8.1
Fetching stimulus-rails 1.2.0
Fetching sprockets-rails 3.4.2
Installing net-smtp 0.3.3
Installing net-pop 0.1.2
Installing net-imap 0.3.1
Installing jbuilder 2.11.5
Using actionmailbox 7.0.4
Using actionmailer 7.0.4
Using rails 7.0.4
Installing importmap-rails 1.1.5
Installing sprockets-rails 3.4.2
Installing stimulus-rails 1.2.0
Installing addressable 2.8.1
Installing turbo-rails 1.3.2
Fetching capybara 3.38.0
Installing activerecord-jdbc-adapter 1.3.22
Installing jdbc-sqlite3 3.8.11.2
Fetching activerecord-jdbcsqlite3-adapter 1.3.22
Installing capybara 3.38.0
Installing activerecord-jdbcsqlite3-adapter 1.3.22
Fetching web-console 4.2.0
Installing web-console 4.2.0
Installing selenium-webdriver 4.6.1
Fetching webdrivers 5.2.0
Installing webdrivers 5.2.0
Bundle complete! 13 Gemfile dependencies, 69 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle binstubs bundler
       rails  importmap:install
rails aborted!
NoMethodError: undefined method `alias_method_chain' for #<Class:ActiveRecord::Base>
Did you mean?  alias_method
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:13:in `singleton class'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:4:in `block in ActiveRecord'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:3:in `<module:ActiveRecord>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:1:in `<main>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/adapter.rb:6:in `<main>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc.rb:52:in `<module:ArJdbc>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc.rb:3:in `<main>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc.rb:9:in `<main>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbcsqlite3-adapter-1.3.22/lib/activerecord-jdbcsqlite3-adapter.rb:2:in `<main>'
/home/hurricup/Projects/untitled2/config/application.rb:7:in `<main>'
/home/hurricup/Projects/untitled2/Rakefile:4:in `<main>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/railties-7.0.4/lib/rails/command.rb:51:in `invoke'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)
       rails  turbo:install stimulus:install
rails aborted!
NoMethodError: undefined method `alias_method_chain' for #<Class:ActiveRecord::Base>
Did you mean?  alias_method
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:13:in `singleton class'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:4:in `block in ActiveRecord'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:3:in `<module:ActiveRecord>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/base_ext.rb:1:in `<main>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc/adapter.rb:6:in `<main>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc.rb:52:in `<module:ArJdbc>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc/jdbc.rb:3:in `<main>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbc-adapter-1.3.22/lib/arjdbc.rb:9:in `<main>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/activerecord-jdbcsqlite3-adapter-1.3.22/lib/activerecord-jdbcsqlite3-adapter.rb:2:in `<main>'
/home/hurricup/Projects/untitled2/config/application.rb:7:in `<main>'
/home/hurricup/Projects/untitled2/Rakefile:4:in `<main>'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/railties-7.0.4/lib/rails/command.rb:51:in `invoke'
/usr/share/rvm/gems/jruby-9.4.0.0@rails/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)

Process finished with exit code 0

The gemfile:

source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.1.0"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.4"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"

# Use jdbcsqlite3 as the database for Active Record
gem "activerecord-jdbcsqlite3-adapter"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"

# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]

# Use Sass to process CSS
# gem "sassc-rails"

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

group :development do
  # Use console on exceptions pages [https://github.com/rails/web-console]
  gem "web-console"

  # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
  # gem "rack-mini-profiler"

  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
  # gem "spring"
end

group :test do
  # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
  gem "capybara"
  gem "selenium-webdriver"
  gem "webdrivers"
end
hurricup commented 1 year ago

rails console does not work either because of this

Ezveus commented 1 year ago

In your Gemfile, specify the version of the gem: gem 'activerecord-jdbc-adapter', '~> 70.0'. Fixed the problem for me.

Edit: My Gemfile looks like this right now:

gem 'activerecord-jdbc-adapter', '~> 70.0'
gem 'activerecord-jdbcpostgresql-adapter', github: 'jruby/activerecord-jdbc-adapter'
headius commented 1 year ago

It seems the rails 7 generator is not using the right versions of the driver. We may need to get a pull request and release of rails out to update it to the 70.0 version.

Ezveus commented 1 year ago

@headius Do you think this is why I get the following stack when using jdbc-adapter 70.0 with jdbcpostgresql-adapter github? Or should I create a new issue?

PS: I'm running this on the offical docker image of JRuby 9.4.0.0-jre8 on an Apple M1 MacOS Ventura 13.0.1.

NoMethodError: undefined method `register_class_with_limit' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x7893c715>
                     initialize_type_map at /usr/local/bundle/gems/activerecord-jdbc-adapter-70.0-java/lib/arjdbc/postgresql/oid_types.rb:120
                              initialize at /usr/local/bundle/gems/activerecord-jdbc-adapter-70.0-java/lib/arjdbc/postgresql/adapter.rb:708
                                     new at org/jruby/RubyClass.java:931
                                     new at /usr/local/bundle/gems/activerecord-jdbc-adapter-70.0-java/lib/arjdbc/jdbc/callbacks.rb:14
                         jdbc_connection at /usr/local/bundle/gems/activerecord-jdbc-adapter-70.0-java/lib/arjdbc/jdbc/connection_methods.rb:10
                   postgresql_connection at /usr/local/bundle/gems/activerecord-jdbc-adapter-70.0-java/lib/arjdbc/postgresql/connection_methods.rb:66
                             public_send at org/jruby/RubyKernel.java:2095
                          new_connection at /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:656
                 checkout_new_connection at /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:700
          try_to_checkout_new_connection at /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:679
                      acquire_connection at /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:640
                                checkout at /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:341
                              connection at /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:181
                     retrieve_connection at /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_adapters/abstract/connection_handler.rb:211
                     retrieve_connection at /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_handling.rb:313
                              connection at /usr/local/bundle/gems/activerecord-7.0.4/lib/active_record/connection_handling.rb:280
                initialize_from_database at /usr/local/bundle/gems/modulorails-1.2.0/lib/modulorails/data.rb:105
                              initialize at /usr/local/bundle/gems/modulorails-1.2.0/lib/modulorails/data.rb:26
                                     new at org/jruby/RubyClass.java:897
                                    data at /usr/local/bundle/gems/modulorails-1.2.0/lib/modulorails.rb:66
                               send_data at /usr/local/bundle/gems/modulorails-1.2.0/lib/modulorails.rb:90
                                 Railtie at /usr/local/bundle/gems/modulorails-1.2.0/lib/modulorails/railtie.rb:43
                            execute_hook at /usr/local/bundle/gems/activesupport-7.0.4/lib/active_support/lazy_load_hooks.rb:92
                  with_execution_control at /usr/local/bundle/gems/activesupport-7.0.4/lib/active_support/lazy_load_hooks.rb:85
                            execute_hook at /usr/local/bundle/gems/activesupport-7.0.4/lib/active_support/lazy_load_hooks.rb:90
                          run_load_hooks at /usr/local/bundle/gems/activesupport-7.0.4/lib/active_support/lazy_load_hooks.rb:76
                                    each at org/jruby/RubyArray.java:1988
                          run_load_hooks at /usr/local/bundle/gems/activesupport-7.0.4/lib/active_support/lazy_load_hooks.rb:75
                                Finisher at /usr/local/bundle/gems/railties-7.0.4/lib/rails/application/finisher.rb:87
                           instance_exec at org/jruby/RubyBasicObject.java:2593
                                     run at /usr/local/bundle/gems/railties-7.0.4/lib/rails/initializable.rb:32
                        run_initializers at /usr/local/bundle/gems/railties-7.0.4/lib/rails/initializable.rb:61
                              tsort_each at /opt/jruby/lib/ruby/stdlib/tsort.rb:228
       each_strongly_connected_component at /opt/jruby/lib/ruby/stdlib/tsort.rb:350
  each_strongly_connected_component_from at /opt/jruby/lib/ruby/stdlib/tsort.rb:431
       each_strongly_connected_component at /opt/jruby/lib/ruby/stdlib/tsort.rb:349
                                    each at org/jruby/RubyArray.java:1988
                                    call at org/jruby/RubyMethod.java:144
       each_strongly_connected_component at /opt/jruby/lib/ruby/stdlib/tsort.rb:347
                              tsort_each at /opt/jruby/lib/ruby/stdlib/tsort.rb:226
                              tsort_each at /opt/jruby/lib/ruby/stdlib/tsort.rb:205
                        run_initializers at /usr/local/bundle/gems/railties-7.0.4/lib/rails/initializable.rb:60
                             initialize! at /usr/local/bundle/gems/railties-7.0.4/lib/rails/application.rb:372
                                  <main> at /app/config/environment.rb:7
                                 require at org/jruby/RubyKernel.java:1057
                                 require at /usr/local/bundle/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38
                    require_environment! at /usr/local/bundle/gems/railties-7.0.4/lib/rails/application.rb:348
                    require_environment! at /usr/local/bundle/gems/railties-7.0.4/lib/rails/command/actions.rb:28
    require_application_and_environment! at /usr/local/bundle/gems/railties-7.0.4/lib/rails/command/actions.rb:15
                                 perform at /usr/local/bundle/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:101
                                     run at /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27
                          invoke_command at /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127
                                dispatch at /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392
                                 perform at /usr/local/bundle/gems/railties-7.0.4/lib/rails/command/base.rb:87
                                  invoke at /usr/local/bundle/gems/railties-7.0.4/lib/rails/command.rb:48
                                  <main> at /usr/local/bundle/gems/railties-7.0.4/lib/rails/commands.rb:18
                                 require at org/jruby/RubyKernel.java:1057
                                  <main> at bin/rails:4
enebo commented 1 year ago

We have no working version of postgresql for Rails 7 yet so it is defaulting to 1.4.3 for "reasons" (1.4.3 targeted multiple versions of Rails while 50+ versions only target a single one so it ends up being a catchall when there is no 70.x for your adapter). If you had used mysql of sqlite3 this would have worked as expected. So weirdly nothing is broken here other than we could have more clearly indicated there is no 70.x of postgresql yet. The only idea I can think of here is an empty release saying it is not supported yet?

postgresql working is a huge priority but behind fixing reported issues for 9.4.1.0. I am hoping in a week or two we will have a 70.x out for postgresql.

@Ezveus Your issue is just that postgresql is not working with 7 and it has nothing to do with Rails generators.

Ezveus commented 1 year ago

Ok! Thanks for the quick answers!

hurricup commented 1 year ago

Looks like this was fixed already and now installs proper version. Presumably by https://github.com/jruby/activerecord-jdbc-adapter/releases/tag/v70.0

enebo commented 1 year ago

@hurricup ah ok. So it will grab 70.0 of the main base dependency gem but if you are trying to use postgresql it will do something strange since there is no activerecord-jdbcpostgresql-adapter 70.0 out. If you are using mysql of sqlite3 it will work.

spacebat commented 1 year ago

How is Postgresql support going? I really appreciate this project but can't evaluate JRuby 9.4 without it. Thinking of chasing down this error but also don't want to duplicate somone else's effort. Any way I can help?

headius commented 1 year ago

Hey there, I think some work has been done but I'm not sure about the status right now. I think @enebo or @kares might know more. It is a priority, but we are short-staffed and also trying to keep up with JRuby showstopper bugs.

You could definitely help! Most of the code for these adapters is in Ruby, and sometimes parts are just duplicated from the Rails codebase. I don't think you would be duplicating any effort, but I will let the others chime in on that.

kares commented 1 year ago

Was planning to look into what's missing in PG support but unfortunately I won't have the time anytime soon as there's a lot of other items in my (JRuby related) OSS queue atm and I just keep delaying stuff due (paid) work.

@spacebat if you're able to take a look I do not think your effort will be duplicate, you can check-in on the jruby channel with @enebo. I am also happy to review any PRs if you come up with any.

enebo commented 1 year ago

@spacebat At this point it is about handling arrays in column data. If you are not using that then it may work for you. There are lots of other failures but the basic common operations are all working ok.

Once that is working I will release the first release with the caveat that not everything is working. Everything fairly ordinary in AR seems to be working but the array support causes lots of problems trying to run AR unit tests.

enebo commented 1 year ago

@spacebat @Ezveus @hurricup I just put out 70.1 of postgresql. Still some issues but we pass 99.8+% of all AR specs so give it a try.