Skip to content

Instantly share code, notes, and snippets.

View flowxcode's full-sized avatar
🦁
flowing

flowxcode

🦁
flowing
View GitHub Profile
-- DROP FUNCTION public.archive_requirements_history();
CREATE OR REPLACE FUNCTION public.archive_requirements_history()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
-- Archive old row to history only if version has changed
IF OLD.version <> NEW.version THEN
INSERT INTO public.requirements_history (