bazzar/migrations/202204191430_change_price.sql
2022-05-04 21:34:26 +02:00

15 lines
282 B
SQL

ALTER TABLE products
ADD COLUMN price integer NOT NULL;
ALTER TABLE products
ADD CONSTRAINT non_negative CHECK (price >= 0);
UPDATE products
SET price = price_major * 100 + price_minor;
ALTER TABLE products
DROP COLUMN price_minor;
ALTER TABLE products
DROP COLUMN price_major;