From a7f2fc5b928138e9dbd7df98f856435d314e2eee Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Sat, 11 Apr 2026 22:54:43 -0600 Subject: [PATCH] Consolidate log migrations --- .../resources/db/migration/V2__seed_data.sql | 122 ------------------ .../db/migration/V4__activity_log_updates.sql | 7 + 2 files changed, 7 insertions(+), 122 deletions(-) create mode 100644 backend/src/main/resources/db/migration/V4__activity_log_updates.sql diff --git a/backend/src/main/resources/db/migration/V2__seed_data.sql b/backend/src/main/resources/db/migration/V2__seed_data.sql index aab02cc1..970c8b43 100644 --- a/backend/src/main/resources/db/migration/V2__seed_data.sql +++ b/backend/src/main/resources/db/migration/V2__seed_data.sql @@ -1739,125 +1739,3 @@ INSERT INTO message (id, conversationId, senderId, content, attachmentUrl, attac (118, 30, 8, 'Happy to help. Please share the order number or the pet name involved.', NULL, NULL, NULL, NULL, '2026-03-02 09:05:00', 1), (119, 30, 45, 'Order #1030 is the one I meant, and the pet is Kiki.', NULL, NULL, NULL, NULL, '2026-03-02 09:10:00', 1), (120, 30, 8, 'Thanks, the account and order are now updated on this conversation.', NULL, NULL, NULL, NULL, '2026-03-02 09:15:00', 0); - -INSERT INTO activityLog (logId, userId, storeId, activity, logTimestamp) VALUES -(1, 1, 1, 'Reviewed store inventory adjustments.', '2026-01-03 08:00:00'), -(2, 2, 2, 'Approved a purchase transaction at the register.', '2026-01-03 17:00:00'), -(3, 3, 1, 'Updated a pet availability record.', '2026-01-04 02:00:00'), -(4, 4, 1, 'Completed a grooming appointment handoff.', '2026-01-04 11:00:00'), -(5, 5, 1, 'Checked a pending adoption record.', '2026-01-04 20:00:00'), -(6, 6, 1, 'Reviewed a refund request tied to an original sale.', '2026-01-05 05:00:00'), -(7, 7, 2, 'Answered a customer support conversation.', '2026-01-05 14:00:00'), -(8, 8, 2, 'Updated a product detail for the catalogue.', '2026-01-05 23:00:00'), -(9, 9, 2, 'Reviewed store inventory adjustments.', '2026-01-06 08:00:00'), -(10, 10, 2, 'Approved a purchase transaction at the register.', '2026-01-06 17:00:00'), -(11, 11, 3, 'Updated a pet availability record.', '2026-01-07 02:00:00'), -(12, 12, 3, 'Completed a grooming appointment handoff.', '2026-01-07 11:00:00'), -(13, 13, 3, 'Checked a pending adoption record.', '2026-01-07 20:00:00'), -(14, 14, 3, 'Reviewed a refund request tied to an original sale.', '2026-01-08 05:00:00'), -(15, 1, 1, 'Answered a customer support conversation.', '2026-01-08 14:00:00'), -(16, 2, 2, 'Updated a product detail for the catalogue.', '2026-01-08 23:00:00'), -(17, 3, 1, 'Reviewed store inventory adjustments.', '2026-01-09 08:00:00'), -(18, 4, 1, 'Approved a purchase transaction at the register.', '2026-01-09 17:00:00'), -(19, 5, 1, 'Updated a pet availability record.', '2026-01-10 02:00:00'), -(20, 6, 1, 'Completed a grooming appointment handoff.', '2026-01-10 11:00:00'), -(21, 7, 2, 'Checked a pending adoption record.', '2026-01-10 20:00:00'), -(22, 8, 2, 'Reviewed a refund request tied to an original sale.', '2026-01-11 05:00:00'), -(23, 9, 2, 'Answered a customer support conversation.', '2026-01-11 14:00:00'), -(24, 10, 2, 'Updated a product detail for the catalogue.', '2026-01-11 23:00:00'), -(25, 11, 3, 'Reviewed store inventory adjustments.', '2026-01-12 08:00:00'), -(26, 12, 3, 'Approved a purchase transaction at the register.', '2026-01-12 17:00:00'), -(27, 13, 3, 'Updated a pet availability record.', '2026-01-13 02:00:00'), -(28, 14, 3, 'Completed a grooming appointment handoff.', '2026-01-13 11:00:00'), -(29, 1, 1, 'Checked a pending adoption record.', '2026-01-13 20:00:00'), -(30, 2, 2, 'Reviewed a refund request tied to an original sale.', '2026-01-14 05:00:00'), -(31, 3, 1, 'Answered a customer support conversation.', '2026-01-14 14:00:00'), -(32, 4, 1, 'Updated a product detail for the catalogue.', '2026-01-14 23:00:00'), -(33, 5, 1, 'Reviewed store inventory adjustments.', '2026-01-15 08:00:00'), -(34, 6, 1, 'Approved a purchase transaction at the register.', '2026-01-15 17:00:00'), -(35, 7, 2, 'Updated a pet availability record.', '2026-01-16 02:00:00'), -(36, 8, 2, 'Completed a grooming appointment handoff.', '2026-01-16 11:00:00'), -(37, 9, 2, 'Checked a pending adoption record.', '2026-01-16 20:00:00'), -(38, 10, 2, 'Reviewed a refund request tied to an original sale.', '2026-01-17 05:00:00'), -(39, 11, 3, 'Answered a customer support conversation.', '2026-01-17 14:00:00'), -(40, 12, 3, 'Updated a product detail for the catalogue.', '2026-01-17 23:00:00'), -(41, 13, 3, 'Reviewed store inventory adjustments.', '2026-01-18 08:00:00'), -(42, 14, 3, 'Approved a purchase transaction at the register.', '2026-01-18 17:00:00'), -(43, 1, 1, 'Updated a pet availability record.', '2026-01-19 02:00:00'), -(44, 2, 2, 'Completed a grooming appointment handoff.', '2026-01-19 11:00:00'), -(45, 3, 1, 'Checked a pending adoption record.', '2026-01-19 20:00:00'), -(46, 4, 1, 'Reviewed a refund request tied to an original sale.', '2026-01-20 05:00:00'), -(47, 5, 1, 'Answered a customer support conversation.', '2026-01-20 14:00:00'), -(48, 6, 1, 'Updated a product detail for the catalogue.', '2026-01-20 23:00:00'), -(49, 7, 2, 'Reviewed store inventory adjustments.', '2026-01-21 08:00:00'), -(50, 8, 2, 'Approved a purchase transaction at the register.', '2026-01-21 17:00:00'), -(51, 9, 2, 'Updated a pet availability record.', '2026-01-22 02:00:00'), -(52, 10, 2, 'Completed a grooming appointment handoff.', '2026-01-22 11:00:00'), -(53, 11, 3, 'Checked a pending adoption record.', '2026-01-22 20:00:00'), -(54, 12, 3, 'Reviewed a refund request tied to an original sale.', '2026-01-23 05:00:00'), -(55, 13, 3, 'Answered a customer support conversation.', '2026-01-23 14:00:00'), -(56, 14, 3, 'Updated a product detail for the catalogue.', '2026-01-23 23:00:00'), -(57, 1, 1, 'Reviewed store inventory adjustments.', '2026-01-24 08:00:00'), -(58, 2, 2, 'Approved a purchase transaction at the register.', '2026-01-24 17:00:00'), -(59, 3, 1, 'Updated a pet availability record.', '2026-01-25 02:00:00'), -(60, 4, 1, 'Completed a grooming appointment handoff.', '2026-01-25 11:00:00'), -(61, 5, 1, 'Checked a pending adoption record.', '2026-01-25 20:00:00'), -(62, 6, 1, 'Reviewed a refund request tied to an original sale.', '2026-01-26 05:00:00'), -(63, 7, 2, 'Answered a customer support conversation.', '2026-01-26 14:00:00'), -(64, 8, 2, 'Updated a product detail for the catalogue.', '2026-01-26 23:00:00'), -(65, 9, 2, 'Reviewed store inventory adjustments.', '2026-01-27 08:00:00'), -(66, 10, 2, 'Approved a purchase transaction at the register.', '2026-01-27 17:00:00'), -(67, 11, 3, 'Updated a pet availability record.', '2026-01-28 02:00:00'), -(68, 12, 3, 'Completed a grooming appointment handoff.', '2026-01-28 11:00:00'), -(69, 13, 3, 'Checked a pending adoption record.', '2026-01-28 20:00:00'), -(70, 14, 3, 'Reviewed a refund request tied to an original sale.', '2026-01-29 05:00:00'), -(71, 1, 1, 'Answered a customer support conversation.', '2026-01-29 14:00:00'), -(72, 2, 2, 'Updated a product detail for the catalogue.', '2026-01-29 23:00:00'), -(73, 3, 1, 'Reviewed store inventory adjustments.', '2026-01-30 08:00:00'), -(74, 4, 1, 'Approved a purchase transaction at the register.', '2026-01-30 17:00:00'), -(75, 5, 1, 'Updated a pet availability record.', '2026-01-31 02:00:00'), -(76, 6, 1, 'Completed a grooming appointment handoff.', '2026-01-31 11:00:00'), -(77, 7, 2, 'Checked a pending adoption record.', '2026-01-31 20:00:00'), -(78, 8, 2, 'Reviewed a refund request tied to an original sale.', '2026-02-01 05:00:00'), -(79, 9, 2, 'Answered a customer support conversation.', '2026-02-01 14:00:00'), -(80, 10, 2, 'Updated a product detail for the catalogue.', '2026-02-01 23:00:00'), -(81, 11, 3, 'Reviewed store inventory adjustments.', '2026-02-02 08:00:00'), -(82, 12, 3, 'Approved a purchase transaction at the register.', '2026-02-02 17:00:00'), -(83, 13, 3, 'Updated a pet availability record.', '2026-02-03 02:00:00'), -(84, 14, 3, 'Completed a grooming appointment handoff.', '2026-02-03 11:00:00'), -(85, 1, 1, 'Checked a pending adoption record.', '2026-02-03 20:00:00'), -(86, 2, 2, 'Reviewed a refund request tied to an original sale.', '2026-02-04 05:00:00'), -(87, 3, 1, 'Answered a customer support conversation.', '2026-02-04 14:00:00'), -(88, 4, 1, 'Updated a product detail for the catalogue.', '2026-02-04 23:00:00'), -(89, 5, 1, 'Reviewed store inventory adjustments.', '2026-02-05 08:00:00'), -(90, 6, 1, 'Approved a purchase transaction at the register.', '2026-02-05 17:00:00'), -(91, 7, 2, 'Updated a pet availability record.', '2026-02-06 02:00:00'), -(92, 8, 2, 'Completed a grooming appointment handoff.', '2026-02-06 11:00:00'), -(93, 9, 2, 'Checked a pending adoption record.', '2026-02-06 20:00:00'), -(94, 10, 2, 'Reviewed a refund request tied to an original sale.', '2026-02-07 05:00:00'), -(95, 11, 3, 'Answered a customer support conversation.', '2026-02-07 14:00:00'), -(96, 12, 3, 'Updated a product detail for the catalogue.', '2026-02-07 23:00:00'), -(97, 13, 3, 'Reviewed store inventory adjustments.', '2026-02-08 08:00:00'), -(98, 14, 3, 'Approved a purchase transaction at the register.', '2026-02-08 17:00:00'), -(99, 1, 1, 'Updated a pet availability record.', '2026-02-09 02:00:00'), -(100, 2, 2, 'Completed a grooming appointment handoff.', '2026-02-09 11:00:00'), -(101, 3, 1, 'Checked a pending adoption record.', '2026-02-09 20:00:00'), -(102, 4, 1, 'Reviewed a refund request tied to an original sale.', '2026-02-10 05:00:00'), -(103, 5, 1, 'Answered a customer support conversation.', '2026-02-10 14:00:00'), -(104, 6, 1, 'Updated a product detail for the catalogue.', '2026-02-10 23:00:00'), -(105, 7, 2, 'Reviewed store inventory adjustments.', '2026-02-11 08:00:00'), -(106, 8, 2, 'Approved a purchase transaction at the register.', '2026-02-11 17:00:00'), -(107, 9, 2, 'Updated a pet availability record.', '2026-02-12 02:00:00'), -(108, 10, 2, 'Completed a grooming appointment handoff.', '2026-02-12 11:00:00'), -(109, 11, 3, 'Checked a pending adoption record.', '2026-02-12 20:00:00'), -(110, 12, 3, 'Reviewed a refund request tied to an original sale.', '2026-02-13 05:00:00'), -(111, 13, 3, 'Answered a customer support conversation.', '2026-02-13 14:00:00'), -(112, 14, 3, 'Updated a product detail for the catalogue.', '2026-02-13 23:00:00'), -(113, 1, 1, 'Reviewed store inventory adjustments.', '2026-02-14 08:00:00'), -(114, 2, 2, 'Approved a purchase transaction at the register.', '2026-02-14 17:00:00'), -(115, 3, 1, 'Updated a pet availability record.', '2026-02-15 02:00:00'), -(116, 4, 1, 'Completed a grooming appointment handoff.', '2026-02-15 11:00:00'), -(117, 5, 1, 'Checked a pending adoption record.', '2026-02-15 20:00:00'), -(118, 6, 1, 'Reviewed a refund request tied to an original sale.', '2026-02-16 05:00:00'), -(119, 7, 2, 'Answered a customer support conversation.', '2026-02-16 14:00:00'), -(120, 8, 2, 'Updated a product detail for the catalogue.', '2026-02-16 23:00:00'); diff --git a/backend/src/main/resources/db/migration/V4__activity_log_updates.sql b/backend/src/main/resources/db/migration/V4__activity_log_updates.sql new file mode 100644 index 00000000..03d00660 --- /dev/null +++ b/backend/src/main/resources/db/migration/V4__activity_log_updates.sql @@ -0,0 +1,7 @@ +ALTER TABLE activityLog + ADD COLUMN usernameSnapshot VARCHAR(50) NULL, + ADD COLUMN fullNameSnapshot VARCHAR(100) NULL, + ADD COLUMN roleSnapshot VARCHAR(20) NULL, + ADD COLUMN storeNameSnapshot VARCHAR(100) NULL; + +CREATE INDEX idx_activity_log_timestamp_id ON activityLog(logTimestamp, logId);