| @@ 459-488 (lines=30) @@ | ||
| 456 | // Better exist! |
|
| 457 | $indexes = $smcFunc['db_list_indexes']($table_name, true); |
|
| 458 | ||
| 459 | foreach ($indexes as $index) |
|
| 460 | { |
|
| 461 | // If the name is primary we want the primary key! |
|
| 462 | if ($index['type'] == 'primary' && $index_name == 'primary') |
|
| 463 | { |
|
| 464 | // Dropping primary key? |
|
| 465 | $smcFunc['db_query']('', ' |
|
| 466 | ALTER TABLE ' . $table_name . ' |
|
| 467 | DROP PRIMARY KEY', |
|
| 468 | array( |
|
| 469 | 'security_override' => true, |
|
| 470 | ) |
|
| 471 | ); |
|
| 472 | ||
| 473 | return true; |
|
| 474 | } |
|
| 475 | if ($index['name'] == $index_name) |
|
| 476 | { |
|
| 477 | // Drop the bugger... |
|
| 478 | $smcFunc['db_query']('', ' |
|
| 479 | ALTER TABLE ' . $table_name . ' |
|
| 480 | DROP INDEX ' . $index_name, |
|
| 481 | array( |
|
| 482 | 'security_override' => true, |
|
| 483 | ) |
|
| 484 | ); |
|
| 485 | ||
| 486 | return true; |
|
| 487 | } |
|
| 488 | } |
|
| 489 | ||
| 490 | // Not to be found ;( |
|
| 491 | return false; |
|
| @@ 619-647 (lines=29) @@ | ||
| 616 | if ($index_name != 'primary') |
|
| 617 | $index_name = $table_name . '_' . $index_name; |
|
| 618 | ||
| 619 | foreach ($indexes as $index) |
|
| 620 | { |
|
| 621 | // If the name is primary we want the primary key! |
|
| 622 | if ($index['type'] == 'primary' && $index_name == 'primary') |
|
| 623 | { |
|
| 624 | // Dropping primary key is odd... |
|
| 625 | $smcFunc['db_query']('', ' |
|
| 626 | ALTER TABLE ' . $table_name . ' |
|
| 627 | DROP CONSTRAINT ' . $index['name'], |
|
| 628 | array( |
|
| 629 | 'security_override' => true, |
|
| 630 | ) |
|
| 631 | ); |
|
| 632 | ||
| 633 | return true; |
|
| 634 | } |
|
| 635 | if ($index['name'] == $index_name) |
|
| 636 | { |
|
| 637 | // Drop the bugger... |
|
| 638 | $smcFunc['db_query']('', ' |
|
| 639 | DROP INDEX ' . $index_name, |
|
| 640 | array( |
|
| 641 | 'security_override' => true, |
|
| 642 | ) |
|
| 643 | ); |
|
| 644 | ||
| 645 | return true; |
|
| 646 | } |
|
| 647 | } |
|
| 648 | ||
| 649 | // Not to be found ;( |
|
| 650 | return false; |
|