Include samples in view (#443)
* Include samples in view * Bump migration version * Remove accidentally checked in file
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
CREATE OR REPLACE VIEW public.v_analytics_orders_rows_not_delivered
|
||||||
|
AS
|
||||||
|
SELECT order_rows.id AS order_row_id,
|
||||||
|
orders.id AS orderid,
|
||||||
|
orders.inserted AS order_date,
|
||||||
|
CASE type
|
||||||
|
WHEN 'sample' THEN 'sample'
|
||||||
|
ELSE order_rows.data ->> 'group'::text
|
||||||
|
END AS product_group,
|
||||||
|
order_rows.data ->> 'artNo'::text AS artno,
|
||||||
|
order_rows.status::text AS status,
|
||||||
|
order_rows.data ->> 'name'::text AS name,
|
||||||
|
order_rows.data ->> 'material'::text AS material
|
||||||
|
FROM order_rows
|
||||||
|
JOIN orders ON order_rows.order_id = orders.id
|
||||||
|
WHERE (order_rows.type = ANY (ARRAY['print'::order_row_type, 'stock'::order_row_type, 'sample'::order_row_type])) AND orders.confirmed = 1 AND orders.delivered = 0 AND orders.canceled = 0 AND orders.paid = 1;
|
||||||
|
|
||||||
|
GRANT SELECT ON TABLE public.v_analytics_orders_rows_not_delivered TO datastudio;
|
||||||
Reference in New Issue
Block a user