Skip to content

Commit

Permalink
Fix default value quote
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Aug 30, 2012
1 parent d092816 commit c2378cf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/SQLBuilder/MigrationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,17 @@ public function addColumn( $table, $column )
}

if( isset($column->default) ) {
$sql .= ' DEFAULT ' . $column->default;
$default = $column->default;

if( is_string($column->default) ) {
$default = $this->driver->quote($column->default);
}
elseif( is_array($column->default) ) {
$default = $column->default[0];
} else {
$default = $column->default;
}
$sql .= ' DEFAULT ' . $default;
}

if( $column->unique ) {
Expand Down

0 comments on commit c2378cf

Please sign in to comment.