Add Updated At to Tasks And Libraries

This commit is contained in:
speatzle 2024-05-28 21:32:57 +02:00
parent ec645f6162
commit c04aa74364
14 changed files with 74 additions and 38 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE tasks
DROP updated_at;

View file

@ -0,0 +1,2 @@
ALTER TABLE tasks
ADD updated_at TIMESTAMP NOT NULL DEFAULT current_timestamp;

View file

@ -0,0 +1 @@
DROP FUNCTION update_updated_at_column;

View file

@ -0,0 +1,7 @@
CREATE OR REPLACE FUNCTION update_updated_at_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = clock_timestamp();
RETURN NEW;
END;
$$ language 'plpgsql';

View file

@ -0,0 +1 @@
DROP TRIGGER update_tasks_timestamp;

View file

@ -0,0 +1 @@
CREATE TRIGGER update_tasks_timestamp BEFORE UPDATE ON tasks FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column();

View file

@ -0,0 +1,2 @@
ALTER TABLE files
DROP updated_at;

View file

@ -0,0 +1,2 @@
ALTER TABLE files
ADD updated_at TIMESTAMP NOT NULL DEFAULT current_timestamp;

View file

@ -0,0 +1 @@
DROP TRIGGER update_files_timestamp;

View file

@ -0,0 +1 @@
CREATE TRIGGER update_files_timestamp BEFORE UPDATE ON files FOR EACH ROW EXECUTE PROCEDURE update_updated_at_column();