mirror of
https://github.com/internetee/registry.git
synced 2025-06-04 11:47:30 +02:00
14 lines
356 B
Ruby
14 lines
356 B
Ruby
class AddInvoiceItemsQuantityConstraint < ActiveRecord::Migration[6.0]
|
|
def up
|
|
execute <<~SQL
|
|
ALTER TABLE invoice_items ADD CONSTRAINT invoice_items_quantity_is_positive
|
|
CHECK (quantity > 0);
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
execute <<~SQL
|
|
ALTER TABLE invoice_items DROP CONSTRAINT invoice_items_quantity_is_positive;
|
|
SQL
|
|
end
|
|
end
|