Module: ActiveRecord::Postgres::Constraints::CommandRecorder
- Defined in:
- lib/active_record/postgres/constraints/command_recorder.rb
Instance Method Summary collapse
- #add_check_constraint(*args, &block) ⇒ Object
- #invert_add_check_constraint(args, &block) ⇒ Object
- #invert_remove_check_constraint(args, &block) ⇒ Object
- #remove_check_constraint(*args, &block) ⇒ Object
Instance Method Details
#add_check_constraint(*args, &block) ⇒ Object
6 7 8 |
# File 'lib/active_record/postgres/constraints/command_recorder.rb', line 6 def add_check_constraint(*args, &block) record(:add_check_constraint, args, &block) end |
#invert_add_check_constraint(args, &block) ⇒ Object
10 11 12 |
# File 'lib/active_record/postgres/constraints/command_recorder.rb', line 10 def invert_add_check_constraint(args, &block) [:remove_check_constraint, args, block] end |
#invert_remove_check_constraint(args, &block) ⇒ Object
24 25 26 |
# File 'lib/active_record/postgres/constraints/command_recorder.rb', line 24 def invert_remove_check_constraint(args, &block) [:add_check_constraint, args, block] end |
#remove_check_constraint(*args, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/active_record/postgres/constraints/command_recorder.rb', line 14 def remove_check_constraint(*args, &block) if args.length < 3 raise ActiveRecord::IrreversibleMigration, 'To make this migration reversible, pass the constraint to '\ 'remove_check_constraint, i.e. `remove_check_constraint, '\ "#{args[0].inspect}, #{args[1].inspect}, 'price > 999'`" end record(:remove_check_constraint, args, &block) end |