Change all db now to clock_timestamp for triggers

This commit is contained in:
Clemens Schwaighofer
2024-12-12 12:02:49 +09:00
parent 7d4c9724fe
commit e793c3975b
7 changed files with 76 additions and 47 deletions

View File

@@ -7,11 +7,11 @@ DECLARE
random_length INT = 25; -- that should be long enough
BEGIN
IF TG_OP = 'INSERT' THEN
NEW.date_created := 'now';
NEW.date_created := clock_timestamp();
NEW.cuid := random_string(random_length);
NEW.cuuid := gen_random_uuid();
ELSIF TG_OP = 'UPDATE' THEN
NEW.date_updated := 'now';
NEW.date_updated := clock_timestamp();
END IF;
RETURN NEW;
END;