jaeyun0503 commented on code in PR #3675:
URL: https://github.com/apache/texera/pull/3675#discussion_r2286638939
##########
deployment/k8s/texera-helmchart/files/texera_ddl.sql:
##########
@@ -393,6 +393,28 @@ CREATE TABLE IF NOT EXISTS time_log
last_login TIMESTAMPTZ
);
+WITH ts AS (SELECT '2025-01-01 00:00:00-07'::timestamptz AS t)
+INSERT INTO time_log (uid, acc_creation)
+SELECT u.uid, ts.t
+FROM "user" u, ts
+ON CONFLICT (uid) DO NOTHING;
+
+CREATE OR REPLACE FUNCTION time_log_autocreate()
+RETURNS trigger AS $$
+BEGIN
+INSERT INTO time_log (uid, acc_creation)
+VALUES (NEW.uid, now())
+ON CONFLICT (uid) DO NOTHING;
+RETURN NEW;
+END
+$$ LANGUAGE plpgsql;
+
+DROP TRIGGER IF EXISTS trg_time_log_autocreate ON "user";
+CREATE TRIGGER trg_time_log_autocreate
Review Comment:
@aicam When a new user is entered into `user`, the trigger will make sure
that it also adds the corresponding (uid, acc_creation) to the `time_log` table
as I enforced the acc_creation column to be NOT NULL.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]