public function getAddTableDDL(Table $table) { $tableDescription = $table->hasDescription() ? $this->getCommentLineDDL($table->getDescription()) : ''; $lines = array(); foreach ($table->getColumns() as $column) { $lines[] = $this->getColumnDDL($column); } if ($table->hasPrimaryKey() && count($table->getPrimaryKey()) > 1) { $lines[] = $this->getPrimaryKeyDDL($table); } foreach ($table->getUnices() as $unique) { $lines[] = $this->getUniqueDDL($unique); } $sep = ",\n\t"; $pattern = "\n%sCREATE TABLE %s\n(\n\t%s\n);\n"; return sprintf($pattern, $tableDescription, $this->quoteIdentifier($table->getName()), implode($sep, $lines)); }
public function getAddTableDDL(Table $table) { $tableDescription = $table->hasDescription() ? $this->getCommentLineDDL($table->getDescription()) : ''; $lines = array(); foreach ($table->getColumns() as $column) { $lines[] = $this->getColumnDDL($column); } foreach ($table->getUnices() as $unique) { $lines[] = $this->getUniqueDDL($unique); } $sep = ",\r\n "; $pattern = "\r\n%sCREATE TABLE %s\r\n(\r\n %s\r\n)%s;\r\n"; $ret = sprintf($pattern, $tableDescription, $this->quoteIdentifier($table->getName()), implode($sep, $lines), $this->generateBlockStorage($table)); $ret .= $this->getAddPrimaryKeyDDL($table); $ret .= $this->getAddSequencesDDL($table); return $ret; }