| @@ 381-392 (lines=12) @@ | ||
| 378 | * |
|
| 379 | * @return bool true if no errors, false if errors encountered |
|
| 380 | */ |
|
| 381 | public function dropColumn($table, $column) |
|
| 382 | { |
|
| 383 | // Find table def. |
|
| 384 | if (isset($this->tables[$table])) { |
|
| 385 | $tableDef = $this->tables[$table]; |
|
| 386 | $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP COLUMN `{$column}`"; |
|
| 387 | } else { |
|
| 388 | return $this->tableNotEstablished(); |
|
| 389 | } |
|
| 390 | ||
| 391 | return true; |
|
| 392 | } |
|
| 393 | ||
| 394 | /** |
|
| 395 | * Add drop index operation to the work queue |
|
| @@ 402-412 (lines=11) @@ | ||
| 399 | * |
|
| 400 | * @return bool true if no errors, false if errors encountered |
|
| 401 | */ |
|
| 402 | public function dropIndex($name, $table) |
|
| 403 | { |
|
| 404 | if (isset($this->tables[$table])) { |
|
| 405 | $tableDef = $this->tables[$table]; |
|
| 406 | $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP INDEX `{$name}`"; |
|
| 407 | } else { |
|
| 408 | return $this->tableNotEstablished(); |
|
| 409 | } |
|
| 410 | ||
| 411 | return true; |
|
| 412 | } |
|
| 413 | ||
| 414 | /** |
|
| 415 | * Add drop for all (non-PRIMARY) keys for a table to the work |
|
| @@ 457-467 (lines=11) @@ | ||
| 454 | * |
|
| 455 | * @return bool true if no errors, false if errors encountered |
|
| 456 | */ |
|
| 457 | public function dropPrimaryKey($table) |
|
| 458 | { |
|
| 459 | if (isset($this->tables[$table])) { |
|
| 460 | $tableDef = $this->tables[$table]; |
|
| 461 | $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP PRIMARY KEY "; |
|
| 462 | } else { |
|
| 463 | return $this->tableNotEstablished(); |
|
| 464 | } |
|
| 465 | ||
| 466 | return true; |
|
| 467 | } |
|
| 468 | ||
| 469 | /** |
|
| 470 | * Add drop of table to the work queue |
|
| @@ 476-485 (lines=10) @@ | ||
| 473 | * |
|
| 474 | * @return bool true if no errors, false if errors encountered |
|
| 475 | */ |
|
| 476 | public function dropTable($table) |
|
| 477 | { |
|
| 478 | if (isset($this->tables[$table])) { |
|
| 479 | $tableDef = $this->tables[$table]; |
|
| 480 | $this->queue[] = "DROP TABLE `{$tableDef['name']}` "; |
|
| 481 | unset($this->tables[$table]); |
|
| 482 | } |
|
| 483 | // no table is not an error since we are dropping it anyway |
|
| 484 | return true; |
|
| 485 | } |
|
| 486 | ||
| 487 | ||
| 488 | /** |
|
| @@ 678-688 (lines=11) @@ | ||
| 675 | * |
|
| 676 | * @return bool true if no errors, false if errors encountered |
|
| 677 | */ |
|
| 678 | public function truncate($table) |
|
| 679 | { |
|
| 680 | if (isset($this->tables[$table])) { |
|
| 681 | $tableDef = $this->tables[$table]; |
|
| 682 | $this->queue[] = "TRUNCATE TABLE `{$tableDef['name']}`"; |
|
| 683 | } else { |
|
| 684 | return $this->tableNotEstablished(); |
|
| 685 | } |
|
| 686 | ||
| 687 | return true; |
|
| 688 | } |
|
| 689 | ||
| 690 | ||
| 691 | ||