Commit c6b7343
fix: execute deduplication SQL independently to guarantee execution
Previous fix still had the deduplication inside the IF EXISTS (table) block.
If table exists, the deduplication would run, but it was still part of a DO
block which could fail silently.
Split into TWO separate Exec calls:
1. DO block for column additions (snapshot_date, backers_count)
2. Standalone DELETE for deduplication (runs EVERY time)
Also moved SET NOT NULL inside the IF NOT EXISTS block where it belongs
(only needed when first adding the column).
This ensures deduplication always runs before AutoMigrate creates the unique
index, regardless of database state.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 9f08cf2 commit c6b7343
1 file changed
Lines changed: 14 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
163 | 164 | | |
164 | 165 | | |
165 | 166 | | |
| |||
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | 173 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | 174 | | |
184 | 175 | | |
185 | 176 | | |
186 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
187 | 190 | | |
188 | 191 | | |
189 | 192 | | |
| |||
0 commit comments