Commit 40bdc78
authored
Allow double underscores in index names (#136)
See:
#133 (comment)
When creating new tables in SQLite, original index names are prefixed
with the table name. This is because unlike MySQL, SQLite does not allow
identical index names across the database. Adding a table prefix ensures
the index names are unique.
When running a `show create table` query, we restore the original index
name by removing the table prefix. We split on double underscores but we
did not take into account that the original index name can also contain
`__`. This PR fixes an issue where we explode without a limit. We only
want to explode on the first occurrence of `__`. Unit tests have been
added to ensure this behavior.1 parent 00f31b4 commit 40bdc78
2 files changed
Lines changed: 35 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
| 380 | + | |
| 381 | + | |
381 | 382 | | |
382 | 383 | | |
383 | 384 | | |
| |||
386 | 387 | | |
387 | 388 | | |
388 | 389 | | |
389 | | - | |
| 390 | + | |
| 391 | + | |
390 | 392 | | |
391 | 393 | | |
392 | 394 | | |
393 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
394 | 424 | | |
395 | 425 | | |
396 | 426 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3570 | 3570 | | |
3571 | 3571 | | |
3572 | 3572 | | |
3573 | | - | |
3574 | | - | |
3575 | | - | |
| 3573 | + | |
3576 | 3574 | | |
3577 | 3575 | | |
3578 | 3576 | | |
| |||
4214 | 4212 | | |
4215 | 4213 | | |
4216 | 4214 | | |
4217 | | - | |
| 4215 | + | |
| 4216 | + | |
4218 | 4217 | | |
4219 | 4218 | | |
4220 | 4219 | | |
0 commit comments