Skip to content

Commit

Permalink
Fixed table comment format.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Cima committed May 2, 2016
1 parent 152adbb commit 17f7380
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Model/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ public function generateCreationScript($ignoreAutoIncrement = false, $sortKeys =
}

if ($this->comment) {
$tableOptions[] = sprintf('COMMENT \'%s\'', str_replace('\'','\'\'', $this->comment));
$tableOptions[] = sprintf('COMMENT=\'%s\'', str_replace('\'','\'\'', $this->comment));
}

$implodedTableOptions = implode(' ', $tableOptions);
Expand Down
2 changes: 1 addition & 1 deletion src/RegExpPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function tables()
$pattern .= '|';
$pattern .= '(?:COLLATE=.+?)?\s*';
$pattern .= '|';
$pattern .= '(?:COMMENT \'(?<comment>([^\']|\'\')+)\')?\s*';
$pattern .= '(?:COMMENT=\'(?<comment>([^\']|\'\')+)\')?\s*';
$pattern .= ')*';
$pattern .= ')(?:\/\*.+?\*\/)?\s*';
$pattern .= ';/';
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/sakila.sql
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ DROP TABLE IF EXISTS `test`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `test` (
`test1` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'table''s comment';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='table''s comment';
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/sakila_new.sql
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ DROP TABLE IF EXISTS `test`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `test` (
`test1` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT 'table''s comment';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='table''s comment';
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand Down

0 comments on commit 17f7380

Please sign in to comment.