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
+31
View File
@@ -0,0 +1,31 @@
ALTER TABLE "product-printproducts"
DROP COLUMN IF EXISTS listprice,
ADD listprice INT NOT NULL DEFAULT 0;
UPDATE "product-printproducts"
SET listprice = ROUND(price)
FROM (
SELECT
printid,
price * COALESCE(pricepremium, 1) * 100
* CASE printproducts.groupid
WHEN 2
THEN 0.2 -- 0.2m2 is the minimum paid size for canvas
ELSE 1 END AS price -- 1.0m2 is the same for wallpaper
FROM "product-printproducts" printproducts
JOIN "product-products" products ON printproducts.productid = products.productid
JOIN (
SELECT
groupid,
MIN(price) AS price
FROM "product-printprices"
GROUP BY groupid
) prices ON printproducts.groupid = prices.groupid
LEFT JOIN (
SELECT
designerid,
1 + (pricepremium / 100) AS pricepremium
FROM designers
) designers ON products.designerid = designers.designerid
) s
WHERE "product-printproducts".printid = s.printid;