| @@ 658-686 (lines=29) @@ | ||
| 655 | * |
|
| 656 | * @return $this |
|
| 657 | */ |
|
| 658 | protected function synchroniseIndexes() |
|
| 659 | { |
|
| 660 | foreach ($this->comparator->addedIndexes() as $index) { |
|
| 661 | $this->logger()->debug('Adding index [{statement}] into table {table}.', [ |
|
| 662 | 'statement' => $index->sqlStatement(), |
|
| 663 | 'table' => $this->getName(true), |
|
| 664 | ]); |
|
| 665 | ||
| 666 | $this->commander->addIndex($this, $index); |
|
| 667 | } |
|
| 668 | ||
| 669 | foreach ($this->comparator->alteredIndexes() as $pair) { |
|
| 670 | /** |
|
| 671 | * @var AbstractIndex $initial |
|
| 672 | * @var AbstractIndex $current |
|
| 673 | */ |
|
| 674 | list($current, $initial) = $pair; |
|
| 675 | ||
| 676 | $this->logger()->debug('Altering index [{statement}] to [{new}] in table {table}.', [ |
|
| 677 | 'statement' => $initial->sqlStatement(), |
|
| 678 | 'new' => $current->sqlStatement(), |
|
| 679 | 'table' => $this->getName(true), |
|
| 680 | ]); |
|
| 681 | ||
| 682 | $this->commander->alterIndex($this, $initial, $current); |
|
| 683 | } |
|
| 684 | ||
| 685 | return $this; |
|
| 686 | } |
|
| 687 | ||
| 688 | /** |
|
| 689 | * Drop needed foreign keys. |
|
| @@ 712-739 (lines=28) @@ | ||
| 709 | * |
|
| 710 | * @return $this |
|
| 711 | */ |
|
| 712 | protected function synchroniseForeigns() |
|
| 713 | { |
|
| 714 | foreach ($this->comparator->addedForeigns() as $foreign) { |
|
| 715 | $this->logger()->debug('Adding foreign key [{statement}] into table {table}.', [ |
|
| 716 | 'statement' => $foreign->sqlStatement(), |
|
| 717 | 'table' => $this->getName(true), |
|
| 718 | ]); |
|
| 719 | ||
| 720 | $this->commander->addForeign($this, $foreign); |
|
| 721 | } |
|
| 722 | ||
| 723 | foreach ($this->comparator->alteredForeigns() as $pair) { |
|
| 724 | /** |
|
| 725 | * @var AbstractReference $initial |
|
| 726 | * @var AbstractReference $current |
|
| 727 | */ |
|
| 728 | list($current, $initial) = $pair; |
|
| 729 | ||
| 730 | $this->logger()->debug('Altering foreign key [{statement}] to [{new}] in {table}.', [ |
|
| 731 | 'statement' => $initial->sqlStatement(), |
|
| 732 | 'table' => $this->getName(true), |
|
| 733 | ]); |
|
| 734 | ||
| 735 | $this->commander->alterForeign($this, $initial, $current); |
|
| 736 | } |
|
| 737 | ||
| 738 | return $this; |
|
| 739 | } |
|
| 740 | ||
| 741 | /** |
|
| 742 | * Driver specific column schema. |
|