public function finish()
 {
     $colsDef = array();
     $colsDef[] = "`id` INTEGER(11) UNSIGNED NOT NULL AUTO_INCREMENT";
     foreach ($this->_columns as $column) {
         $expanded = Connection::expandColumn($column['type'], $column['options']);
         $colsDef[] = sprintf("`%s` %s", $column['name'], $expanded);
     }
     $colsDef[] = "PRIMARY KEY (`id`)";
     $sql = array();
     $sql[] = sprintf("CREATE TABLE `%s` (", $this->_tableName);
     $sql[] = implode(",\n", $colsDef);
     $sql[] = sprintf(") ENGINE %s;", $this->_options['engine']);
     $sql = implode("\n", $sql);
     $datasource = ConnectionManager::getDataSource();
     $datasource->execute($sql);
 }
Esempio n. 2
0
 /**
  * Removes(drops) an index
  *
  * @param string $tableName 
  * @param string|array $columnNames 
  * @param array $options
  *         - name: name of index (defaults to idx_[colum_names])
  * @return void
  */
 public function removeIndex($tableName, $columnNames, $options = array())
 {
     $this->_connection->removeIndex($tableName, $columnNames, $options);
 }