/** * {@inheritdoc} */ public function alterIndex(AbstractTable $table, AbstractIndex $initial, AbstractIndex $index) { $query = \Spiral\interpolate("ALTER TABLE {table} DROP INDEX {index}, ADD {statement}", ['table' => $table->getName(true), 'index' => $initial->getName(true), 'statement' => $index->sqlStatement(false)]); $this->run($query); return $this; }
/** * Driver specific index adding command. * * @param AbstractIndex $index */ protected function doIndexAdd(AbstractIndex $index) { $this->driver->statement("CREATE {$index->sqlStatement()}"); }
/** * {@inheritdoc} */ protected function doIndexChange(AbstractIndex $index, AbstractIndex $dbIndex) { $query = \Spiral\interpolate("ALTER TABLE {table} DROP INDEX {original}, ADD {statement}", ['table' => $this->getName(true), 'original' => $dbIndex->getName(true), 'statement' => $index->sqlStatement(false)]); $this->driver->statement($query); }
/** * Driver specific index adding command. * * @param AbstractTable $table * @param AbstractIndex $index * @return self */ public function addIndex(AbstractTable $table, AbstractIndex $index) { $this->run("CREATE {$index->sqlStatement()}"); return $this; }