Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

activerecord-jdbcmysql-adapter causing error for truncation

Aperta
#25 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
mysql, postgresql, rails, ruby

Direzione di ricerca

Riproduci il fallimento di truncation da una console Rails con tutti e tre gli adattatori JDBC nel Gemfile, quindi esamina database_cleaner-1.0.1/lib/database_cleaner/active_record/truncation.rb intorno alle righe 176 e 209. Confronta il comportamento di caricamento degli adattatori rimuovendo l’adattatore JDBC mysql; il lavoro è completato quando truncation funziona mentre gli adattatori supportati rimangono inclusi nel bundle.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

We have an application that needs to support multiple database engines, so our Gemfile contains multiple JDBC adapters as so:

gem 'activerecord-jdbcpostgresql-adapter', '~>1.3.7'
gem 'activerecord-jdbcmssql-adapter', '~>1.3.7'
gem 'activerecord-jdbcmysql-adapter', '~>1.3.7'

The app works as we expect, and each setup with a different database works well, however we've just introduced the mysql adapter, and have now found that the database cleaner is failing to truncate the database.

On my machine, I have a postgres database running. If I open up a rails console, and attempt to clean the database with :truncation I get the following error

TypeError: superclass mismatch for class Mysql2Adapter

We haven't changed any code in our app, and if I comment out the mysql JDBC adapter from the Gemfile and bundle install again, I am once again able to clean the database.

This is the stack trace that I get with the error

from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/database_cleaner-1.0.1/lib/database_cleaner/active_record/truncation.rb:209:in `ConnectionAdapters'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/database_cleaner-1.0.1/lib/database_cleaner/active_record/truncation.rb:176:in `ActiveRecord'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/database_cleaner-1.0.1/lib/database_cleaner/active_record/truncation.rb:175:in `(root)'
from org/jruby/RubyKernel.java:1065:in `require'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/database_cleaner-1.0.1/lib/database_cleaner/base.rb:1:in `(root)'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/database_cleaner-1.0.1/lib/database_cleaner/base.rb:108:in `orm_strategy'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/database_cleaner-1.0.1/lib/database_cleaner/base.rb:34:in `create_strategy'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/database_cleaner-1.0.1/lib/database_cleaner/base.rb:38:in `clean_with'
from org/jruby/RubyArray.java:1613:in `each'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/database_cleaner-1.0.1/lib/database_cleaner/configuration.rb:85:in `clean_with'
from /Users/adrianh/.rvm/gems/jruby-1.7.12/gems/database_cleaner-1.0.1/lib/database_cleaner/configuration.rb:85:in `clean_with'

It's very similar (exact same error message) to other issues I've found here, however the line numbers are different so I'm assuming the issue is something different, given that the others have also been resolved and this is still appearing.

Lingua principale
Ruby
Stelle
76
Fork
76
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DatabaseCleaner/database_cleaner-active_record

Tutte le issue di DatabaseCleaner/database_cleaner-active_record

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.