Skip to content

Commit 06a8490

Browse files
authored
Merge pull request #4513 from alphagov/nhistory-service-index
Add service_id index to notification_history
2 parents 2f7f7ba + 2546de8 commit 06a8490

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

migrations/.current-alembic-head

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0506_n_history_job_id_index
1+
0507_n_history_service_id_index

migrations/versions/0506_n_history_job_id_index.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
revision = '0506_n_history_job_id_index'
88
down_revision = '0505_n_history_api_key_index'
99

10+
# NOTE: This migration was a no-op, since the index already existed
1011

1112
def upgrade():
1213
with op.get_context().autocommit_block():
@@ -16,7 +17,4 @@ def upgrade():
1617

1718

1819
def downgrade():
19-
with op.get_context().autocommit_block():
20-
op.execute(
21-
"DROP INDEX CONCURRENTLY IF EXISTS ix_notification_history_job_id"
22-
)
20+
pass
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
Create Date: 2025-07-07 08:26:08.720911
3+
"""
4+
5+
from alembic import op
6+
7+
revision = '0507_n_history_service_id_index'
8+
down_revision = '0506_n_history_job_id_index'
9+
10+
11+
def upgrade():
12+
with op.get_context().autocommit_block():
13+
op.execute(
14+
"CREATE INDEX CONCURRENTLY IF NOT EXISTS ix_notification_history_service_id on notification_history (service_id)"
15+
)
16+
17+
18+
def downgrade():
19+
with op.get_context().autocommit_block():
20+
op.execute(
21+
"DROP INDEX CONCURRENTLY IF EXISTS ix_notification_history_service_id"
22+
)

0 commit comments

Comments
 (0)