From 8b702dd4c01f9910824810109c73e1ffd00a394e Mon Sep 17 00:00:00 2001 From: George Raduta Date: Tue, 20 Oct 2026 13:01:34 +0200 Subject: [PATCH] Preserve updated_at when migrating DESTROYED environment history items to DONE environments_history_items.updated_at is ON UPDATE CURRENT_TIMESTAMP, so the status conversion reset the historical update time of the converted rows. As the status history and current status are ordered by this column, converted items could end up after later events. Explicitly assign updated_at = updated_at to keep the original value. Co-Authored-By: Claude Sonnet 5.5 --- .../v1/20261019110000-environment-destroyed-status-to-done.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/database/migrations/v1/20261019110000-environment-destroyed-status-to-done.js b/lib/database/migrations/v1/20261019110000-environment-destroyed-status-to-done.js index 6d3b59cd82..25427f9348 100644 --- a/lib/database/migrations/v1/20261019110000-environment-destroyed-status-to-done.js +++ b/lib/database/migrations/v1/20261019110000-environment-destroyed-status-to-done.js @@ -15,9 +15,10 @@ /** @type {import('sequelize-cli').Migration} */ module.exports = { + // `updated_at` is explicitly kept as is because the column has ON UPDATE CURRENT_TIMESTAMP, and the status history is ordered by it up: async (queryInterface) => queryInterface.sequelize.query(` UPDATE environments_history_items - SET status = 'DONE' + SET status = 'DONE', updated_at = updated_at WHERE status = 'DESTROYED' `),