jaeyun0503 opened a new pull request, #3717:
URL: https://github.com/apache/texera/pull/3717

   ## Summary
   This PR changes the schema of `user_activity` table. It has been renamed to 
`user_action` to make the table name more conventional and intuitive. Detailed 
changes to the table are listed under "Schema Change".
   Changes are also made to the ddl files and backend file that previously used 
`user_activity`.
   
   Closes Issue #3709.
   
   ## For Developers
   Please do the following to incorporate with new changes:
   - Apply core/scripts/sql/updates/13.sql to your local postgres instance
   
   ## Schema Change `user_action` (previously named `user_activity`)
   1. Changed the table name `user_activity` to `user_action`.
   2. Introduced a primary key `user_action_id`.
   3. Added a foreign key constraint from `user_action` to `user`, and set to 
`ON DELETE SET NULL`.
   5. Changed the column name `type` to `resource_type`.
   6. Changed the column name `id` to `resource_id`.
   7. Changed the column name `activate` to `action`.
   8. Changed the type of 'action' to enum('like', 'unlike', 'clone', 'view').
   9. Changed the column name `activity_time` to `time`.
   10. Changed the order of the columns to `user_action_id, uid, ip, time, 
resource_type, resource_id, action`. 
   
   ## Codebase Changes
   13.sql includes scripts to rename the `user_activity` script to 
`user_action_old` so that the existing data can be copied from the old table 
later. Then it creates `enum` for `action` column and creates the new 
`user_action` table. Once the data rows are inserted into the new table, the 
`user_action_old` is dropped.
   
   Edited ddl files to conform with the schema changes.
   
   HubResource.scala now correctly inserts data rows into `user_action` table.
   
   ## Current Schema
   <img width="581" height="296" alt="Image" 
src="https://github.com/user-attachments/assets/25d2fb89-2c9b-45bf-a57b-e0f65249d0f7";
 />
   
   ## Proposed Schema
   <img width="843" height="378" alt="Image" 
src="https://github.com/user-attachments/assets/d1115059-a076-4856-8bc9-26a8f53ecf38";
 />


-- 
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: dev-unsubscr...@texera.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to