private static function generateIndexes(Template $template, Table $table) { /** @var Index $index */ $indexes = []; foreach ($table->getIndexes() as $index) { $c = "new Index(" . "\"" . $index->getName() . "\"," . "['" . implode('\', \'', $index->getColumns()) . "']"; if ($index->isUnique() || $index->getType() !== null) { $c .= ", " . ($index->isUnique() ? "true" : "false"); } if ($index->getType() !== null) { $c .= ", '" . $index->getType() . "'"; } $c .= ")"; $indexes[] = $c; } $template->set('indexes', implode(",\n" . self::LINE_PREFIX, $indexes)); }
public final function dropIndexes() { $current = Connection::getTableIndices($this->table->getName()); $new = $this->table->getIndexes(); $this->drop($current, $new, $this->table->getName(), 'INDEX'); }