Commit 9626294
committed
fix(dalgorm): make DropIndexes idempotent by skipping missing indexes
GORM's DropIndex emits a bare `DROP INDEX` without `IF EXISTS`, which makes PostgreSQL fail with SQLSTATE 42704 when the target index is absent (e.g. it was already removed by an earlier column rewrite via ChangeColumnsType). Guard each drop with HasIndex so the operation is idempotent and database-neutral, without swallowing genuine errors.
Signed-off-by: DoDiODev <DoDiDev@proton.me>1 parent 5ebdee9 commit 9626294
1 file changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
| 455 | + | |
455 | 456 | | |
456 | | - | |
457 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
458 | 467 | | |
459 | 468 | | |
460 | 469 | | |
| |||
0 commit comments