rails icon indicating copy to clipboard operation
rails copied to clipboard

Support adding and removing `CHECK` constraints in bulk `change_table`

Open fatkodima opened this issue 1 year ago • 0 comments

change_table :users, bulk: true do |t|
  t.integer :age
  t.check_constraint "age >= 0"
end

Before

(0.5ms)  ALTER TABLE "users" ADD "age" integer
(0.4ms)  ALTER TABLE "users" ADD CONSTRAINT chk_rails_124019740c CHECK (age >= 0)

After

(0.8ms)  ALTER TABLE "users" ADD "age" integer, ADD CONSTRAINT chk_rails_124019740c CHECK (age >= 0)

fatkodima avatar May 29 '22 23:05 fatkodima