Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove update trigger (use rabbitmq) instead #864

Merged
merged 2 commits into from
May 5, 2024

Conversation

ImSoZRious
Copy link
Member

@ImSoZRious ImSoZRious commented Jul 7, 2023

This query has already been run if you want to undo this, you need to recreate the trigger with this code.

CREATE OR REPLACE FUNCTION public.notify_insert_submission()
 RETURNS trigger
 LANGUAGE plpgsql
AS $function$
	BEGIN
		perform pg_notify('submit', new.id::text);
		return new;
	END;
$function$;

CREATE OR REPLACE FUNCTION public.notify_update_submission()
 RETURNS trigger
 LANGUAGE plpgsql
AS $function$
	declare 
	payload text;
	begin
		payload := row_to_json(new.*)::text;
		perform pg_notify('update', payload);
		return new;
	END;
$function$;

CREATE TRIGGER on_update AFTER update ON public.submission FOR EACH ROW EXECUTE FUNCTION notify_update_submission();

CREATE TRIGGER on_submit AFTER insert ON public.submission FOR EACH ROW EXECUTE FUNCTION notify_insert_submission();

@vercel
Copy link

vercel bot commented Jul 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
programming-in-th ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 5, 2024 7:18am

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 1.28% 147 / 11481
🔵 Statements 1.28% 147 / 11481
🔵 Functions 2.25% 4 / 177
🔵 Branches 8.94% 17 / 190
File CoverageNo changed files found.
Generated in workflow #803

@iammarkps iammarkps merged commit 0874be7 into main May 5, 2024
7 checks passed
@iammarkps iammarkps deleted the feat/remove-update-trigger branch May 5, 2024 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants