Commit 2ceb315
authored
Fix length of index names for a create table statement (#133)
Fixes: #124
This PR introduces some changes to how we determine the name of an
index. SQLite requires that each index is uniquely named across the
database (not just the table). This causes issues when multiple tables
have the same key names when importing from MySQL. To avoid these
issues, the index name is prefixed with the table name when it is
created. This however results in the indexes having names that are too
long for MySQL so when we run `show create table` the create statements
have these prefixed keys that are too long.
To solve this, we keep adding the table name as a prefix but we remove
it when we generate the create statement. Furthermore, we ensure that
the table name itself has no double underscores in it so we can be sure
that we can split on `__` safely. The result is that each create table
statement will have the original index name and prevents it from being
too long.1 parent 3dfb82e commit 2ceb315
2 files changed
Lines changed: 47 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
287 | | - | |
| 286 | + | |
| 287 | + | |
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
316 | | - | |
| 315 | + | |
| 316 | + | |
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
| 368 | + | |
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
374 | 394 | | |
375 | 395 | | |
376 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
903 | | - | |
904 | | - | |
| 903 | + | |
905 | 904 | | |
906 | 905 | | |
907 | 906 | | |
| |||
3086 | 3085 | | |
3087 | 3086 | | |
3088 | 3087 | | |
3089 | | - | |
| 3088 | + | |
3090 | 3089 | | |
3091 | 3090 | | |
3092 | 3091 | | |
| |||
3570 | 3569 | | |
3571 | 3570 | | |
3572 | 3571 | | |
3573 | | - | |
| 3572 | + | |
| 3573 | + | |
| 3574 | + | |
| 3575 | + | |
| 3576 | + | |
| 3577 | + | |
3574 | 3578 | | |
3575 | 3579 | | |
3576 | 3580 | | |
| |||
4199 | 4203 | | |
4200 | 4204 | | |
4201 | 4205 | | |
| 4206 | + | |
| 4207 | + | |
| 4208 | + | |
| 4209 | + | |
| 4210 | + | |
| 4211 | + | |
| 4212 | + | |
| 4213 | + | |
| 4214 | + | |
| 4215 | + | |
| 4216 | + | |
| 4217 | + | |
| 4218 | + | |
| 4219 | + | |
4202 | 4220 | | |
0 commit comments