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