jan/app-backend/hasura/seeds/jandb/1692711671035_productPromptsSeed.sql
Louis 25a096da28
Resolves #35, resolves #59, resolves #53 (#60)
* fix: [#35] - jan containers wont restart

* chore: remove keycloak health check https://github.com/keycloak/keycloak/issues/17273

* fix: #53 hasura seeds should not yield error on conflict

* fix: #59 hasura image generation action timeout

* chore: jan web - fixes error logs of empty href url
2023-09-05 22:00:01 +07:00

21 lines
1.1 KiB
SQL

SET check_function_bodies = false;
INSERT INTO public.product_prompts (product_id, prompt_id)
SELECT p.id AS product_id, r.id AS prompt_id
FROM public.products p
JOIN public.prompts r
ON (p.id
IN (SELECT x.id FROM public.products x INNER JOIN public.collection_products y ON x.id = y.product_id
INNER JOIN public.collections z ON y.collection_id = z.id
WHERE z.slug = 'text-to-image'))
WHERE r.image_url IS NOT NULL AND r.image_url != '' ON CONFLICT (product_id, prompt_id) DO NOTHING;
INSERT INTO public.product_prompts (product_id, prompt_id)
SELECT p.id AS product_id, r.id AS prompt_id
FROM public.products p
JOIN public.prompts r
ON (p.id
IN (SELECT x.id FROM public.products x INNER JOIN public.collection_products y ON x.id = y.product_id
INNER JOIN public.collections z ON y.collection_id = z.id
WHERE z.slug = 'conversational'))
WHERE r.image_url IS NULL OR r.image_url = '' ON CONFLICT (product_id, prompt_id) DO NOTHING;