Skip to content

Instantly share code, notes, and snippets.

@martimatix
Created March 25, 2019 12:01
Show Gist options
  • Save martimatix/d0d8501129d563e22eccf35a0f3f4069 to your computer and use it in GitHub Desktop.
Save martimatix/d0d8501129d563e22eccf35a0f3f4069 to your computer and use it in GitHub Desktop.
Hasura Gists
-- This will automatically update the `updated_at` column on the table `category`
CREATE OR REPLACE FUNCTION update_modified_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = now();
RETURN NEW;
END;
$$ language 'plpgsql';
CREATE TRIGGER update_category_updated_at BEFORE UPDATE ON category FOR EACH ROW EXECUTE PROCEDURE update_modified_column();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment