Skip to content

Commit f48fd68

Browse files
committed
Split migrations into two to keep transactions.
1 parent a5a7e53 commit f48fd68

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

repositories/migrations/20251118115800_add_case_event_index.sql

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-- +goose Up
2+
3+
alter table case_events
4+
add column org_id uuid not null default '00000000-0000-0000-0000-000000000000';
5+
6+
update case_events
7+
set org_id = c.org_id
8+
from cases c
9+
where c.id = case_events.case_id;
10+
11+
-- +goose Down
12+
13+
alter table case_events drop column org_id;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- +goose Up
2+
-- +goose NO TRANSACTION
3+
4+
create index concurrently if not exists idx_case_events_by_org
5+
on case_events (org_id, event_type, created_at)
6+
where event_type in ('outcome_updated');
7+
8+
-- +goose Down
9+
10+
drop index idx_case_events_by_org;

0 commit comments

Comments
 (0)