bazzar/migrations/202204191430_change_price.sql

15 lines
282 B
MySQL
Raw Permalink Normal View History

2022-04-19 16:49:30 +02:00
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;