Archive old migrations (#426)

* Archive old migrations

* Fix invalid placement of migrations
This commit is contained in:
Rikard Bartholf
2024-10-17 11:19:12 +02:00
committed by GitHub
parent 763262c108
commit ddcbd0afb0
500 changed files with 0 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
-- PW-619: refactor material prices
-- create the new price column
DO $$
BEGIN
BEGIN
ALTER TABLE "product-materials" ADD COLUMN price integer NOT NULL DEFAULT 1;
EXCEPTION
WHEN duplicate_column THEN RAISE NOTICE 'column price already exists in "product-materials".';
END;
END;
$$;
-- populate with default data
UPDATE "product-materials" SET price = 23600 WHERE materialid = 1;
UPDATE "product-materials" SET price = 35600 WHERE materialid = 2;
UPDATE "product-materials" SET price = 79920 WHERE materialid = 3;
UPDATE "product-materials" SET price = 26000 WHERE materialid = 4;
-- drop old views that are no longer used
DROP VIEW IF EXISTS v_materialprice;