function toDialectString(IDialect $dialect) { // // FIXME move to IDialect // return 'DROP INDEX ' . $dialect->quoteIdentifier($this->index->getName()) . ($dialect->getDBDriver()->is(DBDriver::MYSQL) ? ' ON ' . $dialect->quoteIdentifier($this->index->getTable()->getName()) : '') . ($dialect->getDBDriver()->is(DBDriver::PGSQL) ? ' CASCADE ' : '') . ';'; }
/** * Adds a table index * * @param DBIndex $index index to add * @throws DuplicationException thrown when another index with the same name already added * @return DBTable itself */ function addIndex(DBIndex $index) { $name = $index->getName(); if ($name) { if (isset($this->indexes[$name])) { throw new DuplicationException('index', $name); } } else { $name = 'index_' . join('_', $index->getFields()) . (sizeof($this->indexes) + 1); $index->setName($name); } $this->indexes[$name] = $index; return $this; }
function toDialectString(IDialect $dialect) { return 'CREATE ' . $this->index->toDialectString($dialect) . ';'; }