* added new funnel for collections * changed to interger * renamed to correct migration number
24 lines
658 B
SQL
24 lines
658 B
SQL
-- View: public.v_funnel_collections
|
|
|
|
DROP VIEW IF EXISTS public.v_funnel_collections;
|
|
|
|
CREATE VIEW public.v_funnel_collections AS
|
|
SELECT
|
|
ep.id as collection_id,
|
|
ep.name as collection_name,
|
|
jsonb_array_elements_text(metadata->'collection_products')::INTEGER AS product_id,
|
|
ep.inserted,
|
|
ep.published,
|
|
ep.updated,
|
|
ep.description
|
|
FROM editorial_pages ep
|
|
WHERE ep.type = 'collection'
|
|
AND EXISTS (
|
|
SELECT 1
|
|
FROM editorial_content ec
|
|
WHERE ec.editorial_page_id = ep.id
|
|
AND ec.visible = TRUE
|
|
);
|
|
|
|
GRANT SELECT ON TABLE public.v_funnel_collections TO funnel;
|