jruby / activerecord-jdbc-adapter

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

Update `check_all_foreign_keys_valid` for Rails 7.1 #1129

Closed ghiculescu closed 1 year ago

ghiculescu commented 1 year ago

ref: https://github.com/rails/rails/pull/47990

In Rails 7.1 (when that PR is merged), there will be a new method, check_all_foreign_keys_valid!, which adapters can implement to check foreign keys when fixtures are loaded. This PR just implements that method. The Rails 7 all_foreign_keys_valid? method is also preserved.


I didn't make the same change for the Postgres adapter, because this line makes me think that Rails' postgresql/referential_integrity file is being required. In which case the method will already exist (from here) without any gem changes needed. But I'm not an expert on how this adapter works and could be totally wrong; happy to also update for Postgres if needed.

enebo commented 1 year ago

@ghiculescu Thanks for the PR. I just made 70-stable branch so master can be for 71 stuff. If you have any interest in updating our GHA ci files to specify Rails 7.1 dev stuff then we can see how this change does.

ghiculescu commented 1 year ago

I think https://github.com/jruby/activerecord-jdbc-adapter/pull/1129/commits/f784a45f40263c5282cd6144908de2a7333c9883 will to do it. But there are some red tests as is. To be honest I'm not a user of this gem, I just made this PR so we can try to avoid the breaking change in Rails 7.1.

enebo commented 1 year ago

@ghiculescu I appreciate your help and I sort of noticed you were working through other adapters missing this.

enebo commented 1 year ago

@ghiculescu whoops. I spaced this out.