Skip to content
Snippets Groups Projects
Commit 60746156 authored by Laurens Oostwegel's avatar Laurens Oostwegel Committed by Laurens Oostwegel
Browse files

Add last update trigger

parent fed841e3
No related branches found
No related tags found
1 merge request!16Resolve "Add last_update trigger"
Pipeline #57658 passed
......@@ -4,7 +4,7 @@ linter:
before_script:
- apt-get update -y
- apt-get install python3-pip -y -qq
- pip install sqlfluff==0.7.1
- pip install sqlfluff==1.4.5
script:
- sqlfluff lint --dialect postgres
......
-- Create function to set the `last_update` timestamp of a feature
CREATE OR REPLACE FUNCTION public.trigger_set_timestamp()
RETURNS trigger
AS $$
BEGIN
NEW.last_update = NOW();
RETURN NEW;
END;
$$
LANGUAGE plpgsql STABLE PARALLEL SAFE;
-- Create trigger to set the `last_update` timestamp on table `obm_buildings`
CREATE TRIGGER set_timestamp
BEFORE UPDATE ON obm_buildings
FOR EACH ROW
EXECUTE FUNCTION trigger_set_timestamp();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment