Skip to content

Commit

Permalink
Don't generate COMMENT '' in MySQL when creating tables.
Browse files Browse the repository at this point in the history
Refs #4031
  • Loading branch information
markstory committed Jul 21, 2014
1 parent c09e2b9 commit 9f49d17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Database/Schema/MysqlSchema.php
Expand Up @@ -323,7 +323,7 @@ public function columnSql(Table $table, $name) {
) {
$out .= ' DEFAULT CURRENT_TIMESTAMP';
}
if (isset($data['comment'])) {
if (isset($data['comment']) && $data['comment'] !== '') {
$out .= ' COMMENT ' . $this->_driver->schemaValue($data['comment']);
}
return $out;
Expand Down
5 changes: 4 additions & 1 deletion tests/TestCase/Database/Schema/MysqlSchemaTest.php
Expand Up @@ -700,7 +700,10 @@ public function testCreateSql() {
'null' => false,
'comment' => 'The title'
])
->addColumn('body', ['type' => 'text'])
->addColumn('body', [
'type' => 'text',
'comment' => ''
])
->addColumn('created', 'datetime')
->addConstraint('primary', [
'type' => 'primary',
Expand Down

0 comments on commit 9f49d17

Please sign in to comment.