Archive old migrations (#426)
* Archive old migrations * Fix invalid placement of migrations
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user