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

CREATE TRIGGER apps_update_updated_at
BEFORE UPDATE ON apps
FOR EACH ROW
EXECUTE FUNCTION apps_update_updated_at_column();