| @@ 388-399 (lines=12) @@ | ||
| 385 | * |
|
| 386 | * @return bool true if no errors, false if errors encountered |
|
| 387 | */ |
|
| 388 | public function dropColumn($table, $column) |
|
| 389 | { |
|
| 390 | // Find table def. |
|
| 391 | if (isset($this->tables[$table])) { |
|
| 392 | $tableDef = $this->tables[$table]; |
|
| 393 | $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP COLUMN `{$column}`"; |
|
| 394 | } else { |
|
| 395 | return $this->tableNotEstablished(); |
|
| 396 | } |
|
| 397 | ||
| 398 | return true; |
|
| 399 | } |
|
| 400 | ||
| 401 | /** |
|
| 402 | * Add drop index operation to the work queue |
|
| @@ 409-419 (lines=11) @@ | ||
| 406 | * |
|
| 407 | * @return bool true if no errors, false if errors encountered |
|
| 408 | */ |
|
| 409 | public function dropIndex($name, $table) |
|
| 410 | { |
|
| 411 | if (isset($this->tables[$table])) { |
|
| 412 | $tableDef = $this->tables[$table]; |
|
| 413 | $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP INDEX `{$name}`"; |
|
| 414 | } else { |
|
| 415 | return $this->tableNotEstablished(); |
|
| 416 | } |
|
| 417 | ||
| 418 | return true; |
|
| 419 | } |
|
| 420 | ||
| 421 | /** |
|
| 422 | * Add drop for all (non-PRIMARY) keys for a table to the work |
|
| @@ 464-474 (lines=11) @@ | ||
| 461 | * |
|
| 462 | * @return bool true if no errors, false if errors encountered |
|
| 463 | */ |
|
| 464 | public function dropPrimaryKey($table) |
|
| 465 | { |
|
| 466 | if (isset($this->tables[$table])) { |
|
| 467 | $tableDef = $this->tables[$table]; |
|
| 468 | $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP PRIMARY KEY "; |
|
| 469 | } else { |
|
| 470 | return $this->tableNotEstablished(); |
|
| 471 | } |
|
| 472 | ||
| 473 | return true; |
|
| 474 | } |
|
| 475 | ||
| 476 | /** |
|
| 477 | * Add drop of table to the work queue |
|
| @@ 483-492 (lines=10) @@ | ||
| 480 | * |
|
| 481 | * @return bool true if no errors, false if errors encountered |
|
| 482 | */ |
|
| 483 | public function dropTable($table) |
|
| 484 | { |
|
| 485 | if (isset($this->tables[$table])) { |
|
| 486 | $tableDef = $this->tables[$table]; |
|
| 487 | $this->queue[] = "DROP TABLE `{$tableDef['name']}` "; |
|
| 488 | unset($this->tables[$table]); |
|
| 489 | } |
|
| 490 | // no table is not an error since we are dropping it anyway |
|
| 491 | return true; |
|
| 492 | } |
|
| 493 | ||
| 494 | ||
| 495 | /** |
|
| @@ 689-699 (lines=11) @@ | ||
| 686 | * |
|
| 687 | * @return bool true if no errors, false if errors encountered |
|
| 688 | */ |
|
| 689 | public function truncate($table) |
|
| 690 | { |
|
| 691 | if (isset($this->tables[$table])) { |
|
| 692 | $tableDef = $this->tables[$table]; |
|
| 693 | $this->queue[] = "TRUNCATE TABLE `{$tableDef['name']}`"; |
|
| 694 | } else { |
|
| 695 | return $this->tableNotEstablished(); |
|
| 696 | } |
|
| 697 | ||
| 698 | return true; |
|
| 699 | } |
|
| 700 | ||
| 701 | ||
| 702 | ||