Files
database/migrations/000.476.sql
T

8 lines
614 B
SQL

ALTER TABLE prices_other_products DROP COLUMN IF EXISTS paint_price_per_liter;
-- Add new column to prices_other_products for paint price per litre (with made up prices)
ALTER TABLE prices_other_products ADD COLUMN paint_price_per_liter NUMERIC;
UPDATE prices_other_products SET paint_price_per_liter = wallpaper_kit_price; -- Set paint price per litre to the same as wallpaper kit price for now
ALTER TABLE prices_other_products ALTER COLUMN paint_price_per_liter SET NOT NULL;
ALTER TABLE prices_other_products ADD CONSTRAINT valid_paint_price_per_liter CHECK (prices_other_products.paint_price_per_liter > 0);