|
@@ 463-473 (lines=11) @@
|
| 460 |
|
* @param AbstractTable $table |
| 461 |
|
* @param StateComparator $comparator |
| 462 |
|
*/ |
| 463 |
|
protected function createForeigns(AbstractTable $table, StateComparator $comparator) |
| 464 |
|
{ |
| 465 |
|
foreach ($comparator->addedForeigns() as $foreign) { |
| 466 |
|
$this->log('Adding foreign key [{statement}] into table {table}.', [ |
| 467 |
|
'statement' => $foreign->sqlStatement($this->driver), |
| 468 |
|
'table' => $this->identify($table), |
| 469 |
|
]); |
| 470 |
|
|
| 471 |
|
$this->createForeign($table, $foreign); |
| 472 |
|
} |
| 473 |
|
} |
| 474 |
|
|
| 475 |
|
/** |
| 476 |
|
* @param AbstractTable $table |
|
@@ 502-512 (lines=11) @@
|
| 499 |
|
* @param AbstractTable $table |
| 500 |
|
* @param StateComparator $comparator |
| 501 |
|
*/ |
| 502 |
|
protected function createIndexes(AbstractTable $table, StateComparator $comparator) |
| 503 |
|
{ |
| 504 |
|
foreach ($comparator->addedIndexes() as $index) { |
| 505 |
|
$this->log('Adding index [{statement}] into table {table}.', [ |
| 506 |
|
'statement' => $index->sqlStatement($this->driver), |
| 507 |
|
'table' => $this->identify($table), |
| 508 |
|
]); |
| 509 |
|
|
| 510 |
|
$this->createIndex($table, $index); |
| 511 |
|
} |
| 512 |
|
} |
| 513 |
|
|
| 514 |
|
/** |
| 515 |
|
* @param AbstractTable $table |
|
@@ 542-553 (lines=12) @@
|
| 539 |
|
* @param AbstractTable $table |
| 540 |
|
* @param StateComparator $comparator |
| 541 |
|
*/ |
| 542 |
|
protected function createColumns(AbstractTable $table, StateComparator $comparator) |
| 543 |
|
{ |
| 544 |
|
foreach ($comparator->addedColumns() as $column) { |
| 545 |
|
$this->log('Adding column [{statement}] into table {table}.', [ |
| 546 |
|
'statement' => $column->sqlStatement($this->driver), |
| 547 |
|
'table' => $this->identify($table), |
| 548 |
|
]); |
| 549 |
|
|
| 550 |
|
$this->assertValid($column); |
| 551 |
|
$this->createColumn($table, $column); |
| 552 |
|
} |
| 553 |
|
} |
| 554 |
|
|
| 555 |
|
/** |
| 556 |
|
* @param AbstractTable $table |
|
@@ 559-569 (lines=11) @@
|
| 556 |
|
* @param AbstractTable $table |
| 557 |
|
* @param StateComparator $comparator |
| 558 |
|
*/ |
| 559 |
|
protected function dropColumns(AbstractTable $table, StateComparator $comparator) |
| 560 |
|
{ |
| 561 |
|
foreach ($comparator->droppedColumns() as $column) { |
| 562 |
|
$this->log('Dropping column [{statement}] from table {table}.', [ |
| 563 |
|
'statement' => $column->sqlStatement($this->driver), |
| 564 |
|
'table' => $this->identify($table), |
| 565 |
|
]); |
| 566 |
|
|
| 567 |
|
$this->dropColumn($table, $column); |
| 568 |
|
} |
| 569 |
|
} |
| 570 |
|
|
| 571 |
|
/** |
| 572 |
|
* @param AbstractTable $table |
|
@@ 575-585 (lines=11) @@
|
| 572 |
|
* @param AbstractTable $table |
| 573 |
|
* @param StateComparator $comparator |
| 574 |
|
*/ |
| 575 |
|
protected function dropIndexes(AbstractTable $table, StateComparator $comparator) |
| 576 |
|
{ |
| 577 |
|
foreach ($comparator->droppedIndexes() as $index) { |
| 578 |
|
$this->log('Dropping index [{statement}] from table {table}.', [ |
| 579 |
|
'statement' => $index->sqlStatement($this->driver), |
| 580 |
|
'table' => $this->identify($table), |
| 581 |
|
]); |
| 582 |
|
|
| 583 |
|
$this->dropIndex($table, $index); |
| 584 |
|
} |
| 585 |
|
} |
| 586 |
|
|
| 587 |
|
/** |
| 588 |
|
* @param AbstractTable $table |
|
@@ 591-601 (lines=11) @@
|
| 588 |
|
* @param AbstractTable $table |
| 589 |
|
* @param StateComparator $comparator |
| 590 |
|
*/ |
| 591 |
|
protected function dropForeigns(AbstractTable $table, $comparator) |
| 592 |
|
{ |
| 593 |
|
foreach ($comparator->droppedForeigns() as $foreign) { |
| 594 |
|
$this->log('Dropping foreign key [{statement}] from table {table}.', [ |
| 595 |
|
'statement' => $foreign->sqlStatement($this->driver), |
| 596 |
|
'table' => $this->identify($table), |
| 597 |
|
]); |
| 598 |
|
|
| 599 |
|
$this->dropForeign($table, $foreign); |
| 600 |
|
} |
| 601 |
|
} |
| 602 |
|
|
| 603 |
|
/** |
| 604 |
|
* Applied to every column in order to make sure that driver support it. |