Commit 671205e
authored
fix: repair Atlas migration checksums and CockroachDB compatibility (#914)
* fix: repair Atlas migration checksums and version conflicts
- Regenerate atlas.sum for internal-bank-account (missing hash for
20260207000001_create_lien_table.sql added in PR #804)
- Add missing atlas.sum for market-information, control-plane,
forecasting, reconciliation, and reference-data services
- Renumber control-plane migrations to resolve version collision:
three PRs (#835, #839, #840) merged with the same version
20260209000001. Renumbered to 000001 (staff_identity),
000002 (create_manifest_versions), 000003 (manifest_versions),
000004 (manifest_apply_jobs) matching merge chronology
* fix: remove PL/pgSQL trigger from market-information initial migration
CockroachDB does not support PL/pgSQL in user-defined functions. The
enforce_dataset_lifecycle trigger was never applied (atlas.sum was
missing, blocking all migrations). Lifecycle enforcement already
exists at the application layer (domain/dataset_status.go and
service/dataset_service.go). CHECK constraints remain for DB-level
safety.
Note: position-keeping and reference-data services also have PL/pgSQL
triggers that will need similar treatment on fresh CockroachDB clusters.
* fix: defer partial index creation for CockroachDB compatibility
CockroachDB cannot create a partial index on a column added in the
same transaction (column is not yet "public"). Split the is_shared
partial index from 20260119000002 into a separate migration
20260119000003 so the column is committed before the index references
it.
* fix: split market-information migration for CockroachDB transaction visibility
CockroachDB cannot reference columns added by ALTER TABLE or create
partial indexes on them within the same transaction. Split migration
20260119000002 into four parts:
- 000002: ADD COLUMN + CREATE TABLE (DDL only)
- 000003: CREATE INDEX on newly-added is_shared column
- 000004: UPDATE seed data referencing is_shared column
* fix: replace date_trunc expression indexes with plain column indexes
CockroachDB does not support context-dependent operators like
date_trunc() in expression indexes. Replace with plain (created_at
DESC, id DESC) indexes which provide equivalent cursor ordering.
The Go repository queries still use date_trunc() for second-level
precision but benefit from the plain column index for ordering.
* fix: remove COMMENT ON INDEX for CockroachDB compatibility
CockroachDB requires table-qualified syntax for COMMENT ON INDEX
(table@index) which differs from PostgreSQL's bare index name syntax.
Removed COMMENT ON INDEX statements and also removed CONCURRENTLY
(CockroachDB creates indexes online by default).
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>1 parent 16c3597 commit 671205e
14 files changed
Lines changed: 87 additions & 111 deletions
File tree
- services
- control-plane/migrations
- forecasting/migrations
- internal-bank-account/migrations
- market-information/migrations
- reconciliation/migrations
- reference-data/migrations
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
Lines changed: 5 additions & 61 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
184 | 128 | | |
185 | 129 | | |
186 | 130 | | |
| |||
Lines changed: 5 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 71 | + | |
| 72 | + | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
0 commit comments