Commit 5a278bb
committed
Avoid index name clashing with UNIQUE KEY
When we create a foreign key constraint for MySQL we also create an
index, if there is not already an index beginning with the field in
question. UNIQUEness constaint are implemented by indices, and so we
should also skip adding an index if one already exists.
To avoid changing existing fully-working schemas, this change only skips
index creation if one with the same name already exists. This case
currently fails with a duplicate key error in MySQL, eg.,
ERROR 1061 (42000): Duplicate key name 'foo'1 parent b4874ba commit 5a278bb
2 files changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
463 | 473 | | |
464 | 474 | | |
465 | 475 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
284 | 283 | | |
285 | 284 | | |
286 | 285 | | |
| |||
0 commit comments