|
@@ 431-447 (lines=17) @@
|
| 428 |
|
* @param AbstractTable $table |
| 429 |
|
* @param StateComparator $comparator |
| 430 |
|
*/ |
| 431 |
|
protected function alterForeigns(AbstractTable $table, StateComparator $comparator) |
| 432 |
|
{ |
| 433 |
|
foreach ($comparator->alteredForeigns() as $pair) { |
| 434 |
|
/** |
| 435 |
|
* @var AbstractReference $initial |
| 436 |
|
* @var AbstractReference $current |
| 437 |
|
*/ |
| 438 |
|
list($current, $initial) = $pair; |
| 439 |
|
|
| 440 |
|
$this->log('Altering foreign key [{statement}] to [{new}] in {table}.', [ |
| 441 |
|
'statement' => $initial->sqlStatement($this->driver), |
| 442 |
|
'table' => $this->identify($table), |
| 443 |
|
]); |
| 444 |
|
|
| 445 |
|
$this->alterForeign($table, $initial, $current); |
| 446 |
|
} |
| 447 |
|
} |
| 448 |
|
|
| 449 |
|
/** |
| 450 |
|
* @param AbstractTable $table |
|
@@ 469-486 (lines=18) @@
|
| 466 |
|
* @param AbstractTable $table |
| 467 |
|
* @param StateComparator $comparator |
| 468 |
|
*/ |
| 469 |
|
protected function alterIndexes(AbstractTable $table, StateComparator $comparator) |
| 470 |
|
{ |
| 471 |
|
foreach ($comparator->alteredIndexes() as $pair) { |
| 472 |
|
/** |
| 473 |
|
* @var AbstractIndex $initial |
| 474 |
|
* @var AbstractIndex $current |
| 475 |
|
*/ |
| 476 |
|
list($current, $initial) = $pair; |
| 477 |
|
|
| 478 |
|
$this->log('Altering index [{statement}] to [{new}] in table {table}.', [ |
| 479 |
|
'statement' => $initial->sqlStatement($this->driver), |
| 480 |
|
'new' => $current->sqlStatement($this->driver), |
| 481 |
|
'table' => $this->identify($table), |
| 482 |
|
]); |
| 483 |
|
|
| 484 |
|
$this->alterIndex($table, $initial, $current); |
| 485 |
|
} |
| 486 |
|
} |
| 487 |
|
|
| 488 |
|
/** |
| 489 |
|
* @param AbstractTable $table |
|
@@ 508-526 (lines=19) @@
|
| 505 |
|
* @param AbstractTable $table |
| 506 |
|
* @param StateComparator $comparator |
| 507 |
|
*/ |
| 508 |
|
protected function alterColumns(AbstractTable $table, StateComparator $comparator) |
| 509 |
|
{ |
| 510 |
|
foreach ($comparator->alteredColumns() as $pair) { |
| 511 |
|
/** |
| 512 |
|
* @var AbstractColumn $initial |
| 513 |
|
* @var AbstractColumn $current |
| 514 |
|
*/ |
| 515 |
|
list($current, $initial) = $pair; |
| 516 |
|
|
| 517 |
|
$this->log('Altering column [{statement}] to [{new}] in table {table}.', [ |
| 518 |
|
'statement' => $initial->sqlStatement($this->driver), |
| 519 |
|
'new' => $current->sqlStatement($this->driver), |
| 520 |
|
'table' => $this->identify($table), |
| 521 |
|
]); |
| 522 |
|
|
| 523 |
|
$this->assertValid($current); |
| 524 |
|
$this->alterColumn($table, $initial, $current); |
| 525 |
|
} |
| 526 |
|
} |
| 527 |
|
|
| 528 |
|
/** |
| 529 |
|
* @param AbstractTable $table |