From 214abaeeb6c2d4f9e7a0bb88e2ee146e88ca04fe Mon Sep 17 00:00:00 2001 From: Andres Pinto <143480783+apsantiso@users.noreply.github.com> Date: Wed, 15 Apr 2026 15:31:41 +0200 Subject: [PATCH 1/2] chore: add deleted files updated at index --- ...31-create-deleted-files-updated-at-index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 migrations/20260415132931-create-deleted-files-updated-at-index.js diff --git a/migrations/20260415132931-create-deleted-files-updated-at-index.js b/migrations/20260415132931-create-deleted-files-updated-at-index.js new file mode 100644 index 000000000..4bf5a73be --- /dev/null +++ b/migrations/20260415132931-create-deleted-files-updated-at-index.js @@ -0,0 +1,18 @@ +'use strict'; + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.sequelize.query(` + CREATE INDEX CONCURRENTLY idx_deleted_files_updated_at + ON files (updated_at) + WHERE status = 'DELETED'; + `); + }, + + async down(queryInterface, Sequelize) { + await queryInterface.sequelize.query(` + DROP INDEX CONCURRENTLY IF EXISTS idx_deleted_files_updated_at; + `); + }, +}; From 8ca2e4e0fb238813dbb638955ca4887bef380ad4 Mon Sep 17 00:00:00 2001 From: Andres Pinto <143480783+apsantiso@users.noreply.github.com> Date: Thu, 16 Apr 2026 17:45:55 +0200 Subject: [PATCH 2/2] fix: fixed migration --- .../20260416154502-create-user-email-index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 migrations/20260416154502-create-user-email-index.js diff --git a/migrations/20260416154502-create-user-email-index.js b/migrations/20260416154502-create-user-email-index.js new file mode 100644 index 000000000..74846142e --- /dev/null +++ b/migrations/20260416154502-create-user-email-index.js @@ -0,0 +1,17 @@ +'use strict'; + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.sequelize.query(` + CREATE INDEX CONCURRENTLY IF NOT EXISTS users_email_idx + ON public.users(email); + `); + }, + + async down(queryInterface, Sequelize) { + await queryInterface.sequelize.query(` + DROP INDEX CONCURRENTLY IF EXISTS users_email_idx; + `); + } +};