From 820d37ec9c030eeb87468ce14e5e964a86d37f34 Mon Sep 17 00:00:00 2001 From: Jumana Bahrainwala Date: Tue, 17 Oct 2023 12:27:52 -0400 Subject: [PATCH 1/3] add index for notification history --- .../versions/0439_add_index_n_history.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 migrations/versions/0439_add_index_n_history.py diff --git a/migrations/versions/0439_add_index_n_history.py b/migrations/versions/0439_add_index_n_history.py new file mode 100644 index 0000000000..fcd0de9ed9 --- /dev/null +++ b/migrations/versions/0439_add_index_n_history.py @@ -0,0 +1,23 @@ +""" + +Revision ID: 0439_add_index_n_history +Revises: 0438_sms_templates_msgs_left +Create Date: 2023-10-05 00:00:00 + +""" +from datetime import datetime + +from alembic import op +from flask import current_app + +revision = "0439_add_index_n_history" +down_revision = "0438_sms_templates_msgs_left" + +# option 1 +def upgrade(): + op.execute("COMMIT") + op.create_index(op.f("ix_notification_history_created_by_id"), "notification_history", ["created_by_id"], postgresql_concurrently=True) + + +def downgrade(): + op.drop_index(op.f("ix_notification_history_created_by_id"), table_name="notification_history") From 0858e8f02d6f5f6170e0bf38fdd334d08b9c090c Mon Sep 17 00:00:00 2001 From: Jumana Bahrainwala Date: Tue, 17 Oct 2023 12:37:30 -0400 Subject: [PATCH 2/3] fix --- migrations/versions/0439_add_index_n_history.py | 1 - 1 file changed, 1 deletion(-) diff --git a/migrations/versions/0439_add_index_n_history.py b/migrations/versions/0439_add_index_n_history.py index fcd0de9ed9..2e340c4348 100644 --- a/migrations/versions/0439_add_index_n_history.py +++ b/migrations/versions/0439_add_index_n_history.py @@ -8,7 +8,6 @@ from datetime import datetime from alembic import op -from flask import current_app revision = "0439_add_index_n_history" down_revision = "0438_sms_templates_msgs_left" From 88d2668b0e1fb6cb74fbf4d688a612e6f2c34332 Mon Sep 17 00:00:00 2001 From: Jumana Bahrainwala Date: Tue, 17 Oct 2023 12:49:43 -0400 Subject: [PATCH 3/3] fix --- migrations/versions/0439_add_index_n_history.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/migrations/versions/0439_add_index_n_history.py b/migrations/versions/0439_add_index_n_history.py index 2e340c4348..8c9645d0db 100644 --- a/migrations/versions/0439_add_index_n_history.py +++ b/migrations/versions/0439_add_index_n_history.py @@ -12,10 +12,13 @@ revision = "0439_add_index_n_history" down_revision = "0438_sms_templates_msgs_left" + # option 1 def upgrade(): op.execute("COMMIT") - op.create_index(op.f("ix_notification_history_created_by_id"), "notification_history", ["created_by_id"], postgresql_concurrently=True) + op.create_index( + op.f("ix_notification_history_created_by_id"), "notification_history", ["created_by_id"], postgresql_concurrently=True + ) def downgrade():