This is an automated email from the ASF dual-hosted git repository.

aicam pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git


The following commit(s) were added to refs/heads/main by this push:
     new 07f293e3ed chore: rename time_log and column last_login (#3694)
07f293e3ed is described below

commit 07f293e3ed131d433673f821743ea04f01599588
Author: Jaeyun Kim <[email protected]>
AuthorDate: Wed Aug 27 07:07:09 2025 -0700

    chore: rename time_log and column last_login (#3694)
    
    ### Summary
    
    To make the naming of the table `time_log` more intuitive and clear, we
    decided to change the name of `time_log` to `user_last_active_time`, and
    change its column `last_login` to `last_active_time`.
    
    Files that used `time_log` to retrieve information have been changed to
    retrieving information from `user_last_active_time`.
    
    ### For Developers
    Please do the following to incorporate with new changes:
    - Apply core/scripts/sql/updates/12.sql to your local postgres instance
    
    ### Current Design
    <img width="870" height="390" alt="Screenshot 2025-08-25 at 10 54 50"
    
src="https://github.com/user-attachments/assets/79305f26-69a8-4484-b2f6-e63d457ca824";
    />
    
    ### New Design
    <img width="842" height="361" alt="image"
    
src="https://github.com/user-attachments/assets/2520c3a5-464a-40a0-bf33-1771d6f5266b";
    />
    
    ---------
    
    Co-authored-by: Xinyuan Lin <[email protected]>
---
 .../dashboard/admin/user/AdminUserResource.scala   |  8 +++----
 .../edu/uci/ics/texera/auth/JwtAuthFilter.scala    | 12 +++++-----
 core/scripts/sql/texera_ddl.sql                    |  6 ++---
 core/scripts/sql/updates/12.sql                    | 26 ++++++++++++++++++++++
 .../k8s/texera-helmchart/files/texera_ddl.sql      |  6 ++---
 5 files changed, 42 insertions(+), 16 deletions(-)

diff --git 
a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/admin/user/AdminUserResource.scala
 
b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/admin/user/AdminUserResource.scala
index 12311b8df3..f1ff3c509a 100644
--- 
a/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/admin/user/AdminUserResource.scala
+++ 
b/core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/admin/user/AdminUserResource.scala
@@ -29,7 +29,7 @@ import 
edu.uci.ics.texera.web.resource.dashboard.admin.user.AdminUserResource.us
 import edu.uci.ics.texera.web.resource.dashboard.user.quota.UserQuotaResource._
 import org.jasypt.util.password.StrongPasswordEncryptor
 import edu.uci.ics.texera.dao.jooq.generated.tables.User.USER
-import edu.uci.ics.texera.dao.jooq.generated.tables.TimeLog.TIME_LOG
+import 
edu.uci.ics.texera.dao.jooq.generated.tables.UserLastActiveTime.USER_LAST_ACTIVE_TIME
 
 import java.util
 import javax.annotation.security.RolesAllowed
@@ -76,11 +76,11 @@ class AdminUserResource {
         USER.ROLE,
         USER.GOOGLE_AVATAR,
         USER.COMMENT,
-        TIME_LOG.LAST_LOGIN
+        USER_LAST_ACTIVE_TIME.LAST_ACTIVE_TIME
       )
       .from(USER)
-      .leftJoin(TIME_LOG)
-      .on(USER.UID.eq(TIME_LOG.UID))
+      .leftJoin(USER_LAST_ACTIVE_TIME)
+      .on(USER.UID.eq(USER_LAST_ACTIVE_TIME.UID))
       .fetchInto(classOf[UserInfo])
   }
 
diff --git 
a/core/auth/src/main/scala/edu/uci/ics/texera/auth/JwtAuthFilter.scala 
b/core/auth/src/main/scala/edu/uci/ics/texera/auth/JwtAuthFilter.scala
index d8aec6fc25..514a6eba15 100644
--- a/core/auth/src/main/scala/edu/uci/ics/texera/auth/JwtAuthFilter.scala
+++ b/core/auth/src/main/scala/edu/uci/ics/texera/auth/JwtAuthFilter.scala
@@ -25,7 +25,7 @@ import 
edu.uci.ics.texera.dao.jooq.generated.enums.UserRoleEnum
 import jakarta.ws.rs.container.{ContainerRequestContext, 
ContainerRequestFilter, ResourceInfo}
 import jakarta.ws.rs.core.{Context, HttpHeaders, SecurityContext}
 import jakarta.ws.rs.ext.Provider
-import edu.uci.ics.texera.dao.jooq.generated.Tables.TIME_LOG
+import edu.uci.ics.texera.dao.jooq.generated.Tables.USER_LAST_ACTIVE_TIME
 import java.time.OffsetDateTime
 import java.security.Principal
 
@@ -47,12 +47,12 @@ class JwtAuthFilter extends ContainerRequestFilter with 
LazyLogging {
         val user = userOpt.get()
 
         ctx
-          .insertInto(TIME_LOG)
-          .set(TIME_LOG.UID, user.getUid)
-          .set(TIME_LOG.LAST_LOGIN, OffsetDateTime.now())
-          .onConflict(TIME_LOG.UID) // conflict on primary key uid
+          .insertInto(USER_LAST_ACTIVE_TIME)
+          .set(USER_LAST_ACTIVE_TIME.UID, user.getUid)
+          .set(USER_LAST_ACTIVE_TIME.LAST_ACTIVE_TIME, OffsetDateTime.now())
+          .onConflict(USER_LAST_ACTIVE_TIME.UID) // conflict on primary key uid
           .doUpdate()
-          .set(TIME_LOG.LAST_LOGIN, OffsetDateTime.now())
+          .set(USER_LAST_ACTIVE_TIME.LAST_ACTIVE_TIME, OffsetDateTime.now())
           .execute()
 
         requestContext.setSecurityContext(new SecurityContext {
diff --git a/core/scripts/sql/texera_ddl.sql b/core/scripts/sql/texera_ddl.sql
index 7c6cf15c7c..4724743949 100644
--- a/core/scripts/sql/texera_ddl.sql
+++ b/core/scripts/sql/texera_ddl.sql
@@ -350,13 +350,13 @@ CREATE TABLE IF NOT EXISTS site_settings
     updated_at  TIMESTAMP DEFAULT CURRENT_TIMESTAMP
     );
 
--- time_log table
-CREATE TABLE IF NOT EXISTS time_log
+-- user_last_active_time table
+CREATE TABLE IF NOT EXISTS user_last_active_time
 (
     uid            INT          NOT NULL
         PRIMARY KEY
         REFERENCES "user"(uid),
-    last_login     TIMESTAMPTZ
+    last_active_time     TIMESTAMPTZ
 );
 
 -- computing_unit_user_access table
diff --git a/core/scripts/sql/updates/12.sql b/core/scripts/sql/updates/12.sql
new file mode 100644
index 0000000000..8c9afd2a8d
--- /dev/null
+++ b/core/scripts/sql/updates/12.sql
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+\c texera_db
+SET search_path TO texera_db;
+
+BEGIN;
+ALTER TABLE time_log RENAME TO user_last_active_time;
+
+ALTER TABLE user_last_active_time RENAME COLUMN last_login TO last_active_time;
+COMMIT;
\ No newline at end of file
diff --git a/deployment/k8s/texera-helmchart/files/texera_ddl.sql 
b/deployment/k8s/texera-helmchart/files/texera_ddl.sql
index d101eb527c..d1c5fce202 100644
--- a/deployment/k8s/texera-helmchart/files/texera_ddl.sql
+++ b/deployment/k8s/texera-helmchart/files/texera_ddl.sql
@@ -384,13 +384,13 @@ CREATE TABLE IF NOT EXISTS site_settings
     updated_at  TIMESTAMP DEFAULT CURRENT_TIMESTAMP
     );
 
--- time_log table
-CREATE TABLE IF NOT EXISTS time_log
+-- user_last_active_time table
+CREATE TABLE IF NOT EXISTS user_last_active_time
 (
     uid            INT          NOT NULL
         PRIMARY KEY
         REFERENCES "user"(uid),
-    last_login     TIMESTAMPTZ
+    last_active_time     TIMESTAMPTZ
 );
 
 -- computing_unit_user_access table

Reply via email to