Skip to content

Commit

Permalink
fix bug never removing check constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
ccutrer committed Sep 7, 2023
1 parent 558c666 commit f4d96fc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
activerecord-pg-extensions (0.5.0)
activerecord-pg-extensions (0.5.1)
activerecord (~> 7.0.0)
railties (~> 7.0.0)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_7.0.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
activerecord-pg-extensions (0.5.0)
activerecord-pg-extensions (0.5.1)
activerecord (~> 7.0.0)
railties (~> 7.0.0)

Expand Down
4 changes: 2 additions & 2 deletions lib/active_record/pg_extensions/pessimistic_migrations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def add_check_constraint(table_name, expression, if_not_exists: false, **options
end

if ActiveRecord.version < Gem::Version.new("7.1")
def remove_check_constraint(table_name, expression = nil, **options)
return if options[:if_exists] && !check_constraint_for(table_name, expression, **options)
def remove_check_constraint(table_name, expression = nil, if_exists: false, **options)
return if if_exists && !check_constraint_for(table_name, expression, **options)

super
end
Expand Down
2 changes: 1 addition & 1 deletion lib/active_record/pg_extensions/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module ActiveRecord
module PGExtensions
VERSION = "0.5.0"
VERSION = "0.5.1"
end
end

0 comments on commit f4d96fc

Please sign in to comment.