From d3d3dd9458cdf0a2ff08f2514029d461f4522d20 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Wed, 25 Oct 2023 13:02:34 +0800 Subject: [PATCH] add index for status and updated_at columns on user table --- .../migrations/0141.do.add_index_for_cleanup_to_user.sql | 9 +++++++++ .../0141.undo.add_index_for_cleanup_to_user.sql | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100755 packages/db/migrations/0141.do.add_index_for_cleanup_to_user.sql create mode 100755 packages/db/migrations/0141.undo.add_index_for_cleanup_to_user.sql diff --git a/packages/db/migrations/0141.do.add_index_for_cleanup_to_user.sql b/packages/db/migrations/0141.do.add_index_for_cleanup_to_user.sql new file mode 100755 index 000000000..3936b9415 --- /dev/null +++ b/packages/db/migrations/0141.do.add_index_for_cleanup_to_user.sql @@ -0,0 +1,9 @@ +-- Type: DO +-- Name: add_index_for_cleanup_to_user +-- Description: Add index of status and updated_at to omnivore.user table for cleanup of deleted users + +BEGIN; + +CREATE INDEX IF NOT EXISTS user_status_updated_at_idx ON omnivore.user (status, updated_at); + +COMMIT; diff --git a/packages/db/migrations/0141.undo.add_index_for_cleanup_to_user.sql b/packages/db/migrations/0141.undo.add_index_for_cleanup_to_user.sql new file mode 100755 index 000000000..cee6bae43 --- /dev/null +++ b/packages/db/migrations/0141.undo.add_index_for_cleanup_to_user.sql @@ -0,0 +1,9 @@ +-- Type: UNDO +-- Name: add_index_for_cleanup_to_user +-- Description: Add index of status and updated_at to omnivore.user table for cleanup of deleted users + +BEGIN; + +DROP INDEX IF EXISTS user_status_updated_at_idx; + +COMMIT;