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); }