/** * {@inheritdoc} */ protected function synchroniseSchema() { if (!$this->requiresRebuild()) { //Probably some index changed or table renamed return parent::synchroniseSchema(); } $this->logger()->debug("Rebuilding table {table} to apply required modifications.", ['table' => $this->getName(true)]); //Temporary table is required to copy data over $temporary = $this->createTemporary(); //Moving data over $this->copyData($temporary, $this->columnsMapping(true)); //Dropping current table $this->commander->dropTable($this->initial->getName()); //Renaming temporary table (should automatically handle table renaming) $this->commander->renameTable($temporary->getName(), $this->getName()); //We can create needed indexes now foreach ($this->getIndexes() as $index) { $this->commander->addIndex($this, $index); } return $this; }