Peel and stick prices (#336)

This commit is contained in:
Fredrik Ringqvist
2023-08-16 13:54:21 +02:00
committed by GitHub
parent 34fed703a4
commit db717cc8a3
+13
View File
@@ -0,0 +1,13 @@
-- Create peel-and-stick wallpaper prices (with made up prices)
INSERT INTO prices_wallpaper_m2 (material_id, segment_id, market_id, price)
SELECT
(select materialid from "product-materials" where material='self-adhesive-wallpaper'),
segment_id, market_id, price + 10
FROM prices_wallpaper_m2
WHERE material_id = (select materialid from "product-materials" where material = 'premium-wallpaper');
-- Add new column to prices_other_products for peel-and-stick wallpaper kit price. (with made up prices)
ALTER TABLE prices_other_products ADD COLUMN peel_and_stick_wallpaper_kit_price NUMERIC;
UPDATE prices_other_products SET peel_and_stick_wallpaper_kit_price = wallpaper_kit_price + 10;
ALTER TABLE prices_other_products ALTER COLUMN peel_and_stick_wallpaper_kit_price SET NOT NULL;
ALTER TABLE prices_other_products ADD CONSTRAINT valid_peel_and_stick_kit_price CHECK (prices_other_products.peel_and_stick_wallpaper_kit_price > 0);