Files
Rikard BartholfandGitHub ddcbd0afb0 Archive old migrations (#426)
* Archive old migrations

* Fix invalid placement of migrations
2024-10-17 11:19:12 +02:00

14 lines
961 B
SQL

-- 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);