2024-03-25 16:24:48: merge [main:72a62d1996eb71f9a1ab21643bf294148b87ae99];

This commit is contained in:
txix committed 2024-03-25 16:24:48 +03:00
1 parent 0669c6ec0a
commit ed8a4eef5d
85 files changed
+7671 -93

No files matched your search

@@ -0,0 +1,34 @@
-- +goose Up
-- +goose StatementBegin
CREATE OR REPLACE FUNCTION update_created_modified_column_date()
RETURNS TRIGGER AS
$body$
BEGIN
IF TG_OP = 'UPDATE' THEN
NEW.created_at = OLD.created_at;
NEW.updated_at = (now() at time zone 'utc');
ELSIF TG_OP = 'INSERT' THEN
NEW.updated_at = (now() at time zone 'utc');
END IF;
RETURN NEW;
END;
$body$ LANGUAGE plpgsql;
-- +goose StatementEnd
-- +goose StatementBegin
CREATE OR REPLACE FUNCTION update_created_column_date()
RETURNS TRIGGER AS
$body$
BEGIN
IF TG_OP = 'UPDATE' THEN
NEW.created_at = OLD.created_at;
END IF;
RETURN NEW;
END;
$body$ LANGUAGE plpgsql;
-- +goose StatementEnd
-- +goose Down
DROP FUNCTION update_created_column_date;
DROP FUNCTION update_created_modified_column_date;