예제 #1
0
 /**
  * Generate the SQL fragment for a single index in a table.
  *
  * @param TableSchema $table The table object the column is in.
  * @param string $name The name of the column.
  * @return string SQL fragment.
  */
 public function indexSql(TableSchema $table, $name)
 {
     $data = $table->index($name);
     $columns = array_map([$this->_driver, 'quoteIdentifier'], $data['columns']);
     return sprintf('CREATE INDEX %s ON %s (%s)', $this->_driver->quoteIdentifier($name), $this->_driver->quoteIdentifier($table->name()), implode(', ', $columns));
 }
예제 #2
0
 /**
  * Generate the SQL fragment for a single index in a table.
  *
  * @param TableSchema $table The table object the column is in.
  * @param string $name The name of the column.
  * @return string SQL fragment.
  */
 public function indexSql(TableSchema $table, $name)
 {
     $data = $table->index($name);
     if ($data['type'] === TableSchema::INDEX_INDEX) {
         $out = 'KEY ';
     }
     if ($data['type'] === TableSchema::INDEX_FULLTEXT) {
         $out = 'FULLTEXT KEY ';
     }
     $out .= $this->_driver->quoteIdentifier($name);
     return $this->_keySql($out, $data);
 }