mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 01:51:13 -05:00
14 lines
369 B
PL/PgSQL
14 lines
369 B
PL/PgSQL
-- Add helper function for cleanup edge function
|
|
|
|
CREATE OR REPLACE FUNCTION public.get_orphaned_edit_history()
|
|
RETURNS TABLE (id UUID) AS $$
|
|
BEGIN
|
|
RETURN QUERY
|
|
SELECT ieh.id
|
|
FROM item_edit_history ieh
|
|
WHERE NOT EXISTS (
|
|
SELECT 1 FROM submission_items si
|
|
WHERE si.id = ieh.item_id
|
|
);
|
|
END;
|
|
$$ LANGUAGE plpgsql SECURITY DEFINER SET search_path = public; |