/** * Builds the DDL SQL to add an Index. * * @param Index $index * @return string */ public function getAddIndexDDL(Index $index) { // don't create index form primary key if ($this->getPrimaryKeyName($index->getTable()) == $this->quoteIdentifier($index->getName())) { return ''; } $pattern = "\nCREATE %sINDEX %s ON %s (%s)%s;\n"; return sprintf($pattern, $index->isUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->quoteIdentifier($index->getTable()->getName()), $this->getColumnListDDL($index->getColumnObjects()), $this->generateBlockStorage($index)); }
/** * Builds the DDL SQL for an Index object. * * @param Index $index * @return string */ public function getIndexDDL(Index $index) { return sprintf('%sINDEX %s (%s)', $index->isUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->getColumnListDDL($index->getColumnObjects())); }