Add fields to v_funnel_order_rows (#308)

* Add fields to v_funnel_order_rows

* Bump migration version before release
This commit is contained in:
Rikard Bartholf
2023-01-25 14:13:56 +01:00
committed by GitHub
parent bbb669dadc
commit 29bcd2f0ae
+34
View File
@@ -0,0 +1,34 @@
-- View: public.v_funnel_order_rows
DROP VIEW IF EXISTS public.v_funnel_order_rows;
CREATE OR REPLACE VIEW public.v_funnel_order_rows
AS
SELECT r.id,
r.order_id,
r.inserted,
r.type,
o.customer_type,
o.market,
pp.path,
pp.publishing_date,
pp.ref1,
pp.ref2,
r.data ->> 'width' AS width,
r.data ->> 'height' AS height,
r.sub_type,
r.status,
r.price,
r.commission_amount,
r.external_status,
r.data ->> 'productId'::text AS product_id,
r.data ->> 'material'::text AS material,
r.data ->> 'artNo'::text AS artno,
r.data ->> 'designer'::text AS designer,
(r.data ->> 'inquiryid'::text)::integer AS inquiry_id
FROM order_rows r
JOIN orders o ON r.order_id = o.id
LEFT JOIN "product-products" pp ON (r.data ->> 'productId')::integer = pp.productid;
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE public.v_funnel_order_rows TO photowall;
GRANT SELECT ON public.v_funnel_order_rows TO funnel;