Module: SafePgMigrations::Helpers::SatisfiedHelper
- Included in:
- Polyfills::IndexDefinitionPolyfill
- Defined in:
- lib/safe-pg-migrations/helpers/satisfied_helper.rb
Class Method Summary collapse
- .satisfied?(version) ⇒ Boolean
- .satisfies_add_check_constraints! ⇒ Object
- .satisfies_add_check_constraints? ⇒ Boolean
- .satisfies_add_column_update_rows_backfill? ⇒ Boolean
- .satisfies_change_column_null_requirements? ⇒ Boolean
Class Method Details
.satisfied?(version) ⇒ Boolean
25 26 27 |
# File 'lib/safe-pg-migrations/helpers/satisfied_helper.rb', line 25 def satisfied?(version) Gem::Requirement.new(version).satisfied_by? Gem::Version.new(::ActiveRecord::VERSION::STRING) end |
.satisfies_add_check_constraints! ⇒ Object
11 12 13 14 15 |
# File 'lib/safe-pg-migrations/helpers/satisfied_helper.rb', line 11 def satisfies_add_check_constraints! return if satisfies_add_check_constraints? raise NotImplementedError, 'add_check_constraint is not supported in your ActiveRecord version' end |
.satisfies_add_check_constraints? ⇒ Boolean
17 18 19 |
# File 'lib/safe-pg-migrations/helpers/satisfied_helper.rb', line 17 def satisfies_add_check_constraints? satisfied? '>=6.1.0' end |
.satisfies_add_column_update_rows_backfill? ⇒ Boolean
21 22 23 |
# File 'lib/safe-pg-migrations/helpers/satisfied_helper.rb', line 21 def satisfies_add_column_update_rows_backfill? satisfies_change_column_null_requirements? end |
.satisfies_change_column_null_requirements? ⇒ Boolean
7 8 9 |
# File 'lib/safe-pg-migrations/helpers/satisfied_helper.rb', line 7 def satisfies_change_column_null_requirements? satisfies_add_check_constraints? && SafePgMigrations.pg_version_num >= 120_000 end |