Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Rails 6.1 support? #37

Closed
steobrien opened this issue Dec 22, 2020 · 2 comments
Closed

Rails 6.1 support? #37

steobrien opened this issue Dec 22, 2020 · 2 comments

Comments

@steobrien
Copy link

Thanks for your work on this library!

We see this issue for Rails 6.1:

NameError: uninitialized constant ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation
Did you mean?  ActiveRecord::ConnectionAdapters::SchemaCreation
               ActiveRecord::SchemaMigration
/home/runner/src/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `block in load_missing_constant'
/home/runner/src/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:9:in `without_bootsnap_cache'
/home/runner/src/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `rescue in load_missing_constant'
/home/runner/src/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
/home/runner/src/vendor/bundle/ruby/2.7.0/gems/active_record-postgres-constraints-0.2.2/lib/active_record/postgres/constraints/railtie.rb:23:in `apply_patch!'
/home/runner/src/vendor/bundle/ruby/2.7.0/gems/active_record-postgres-constraints-0.2.2/lib/active_record/postgres/constraints/railtie.rb:13:in `block (2 levels) in <class:Railtie>'

Everything works fine with Rails 6.0.

@coreyja
Copy link

coreyja commented Dec 22, 2020

Thanks @betesh for quickly hoping on this issue!

For others who see this I realized that Rails 6.1 has built in check_constraint support that was sufficient for my use-case.
rails/rails#31323

@betesh
Copy link
Owner

betesh commented Apr 22, 2021

Although #1 added support for exclude constraints, my goal in creating this gem was to support check constraints. Now that check constraints are supported by Rails 6.1, this gem has finished served its purpose for me and, I believe, most users. Feel free to fork and remove the check constraint feature if you want to continue using this gem for exclude constraints.

A word of caution for those who are dropping this gem from their Gemfile: Method signatures will change.

This gem:

t.check_constraint(name_or_conditions, conditions = nil)
add_check_constraint(table_name, name, conditions)
remove_check_constraint(table, name, conditions = nil)

Rails 6.1:

t.check_constraint(expression, name: nil)
add_check_constraint(table_name, expression, **options)
remove_check_constraint(table_name, expression = nil, **options)

Furthermore, in Rails 6.1, as far as I can tell, expression must be a String. Hash and Array are no longer supported.

So migrating involves more than just dropping the gem from the Gemfile.

@betesh betesh closed this as completed Apr 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants