aboutsummaryrefslogtreecommitdiff
path: root/deploy/update_updated_at.sql
blob: a41d27f990c32b0db267b44b122ed8a4289f7618 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-- Deploy diary:update_updated_at to pg
-- requires: schema

BEGIN;

SET search_path to diary;

CREATE OR REPLACE FUNCTION update_updated_at() RETURNS TRIGGER AS $$
  BEGIN
    NEW.updated_at = NOW();
    RETURN NEW;
  END;
$$ LANGUAGE plpgsql;

COMMIT;