Skip to content

Commit

Permalink
fix comments with ,
Browse files Browse the repository at this point in the history
  • Loading branch information
kokspflanze committed Nov 12, 2018
1 parent 8110b3c commit 1a21f0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Model/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function parse($stmt)
$this->type = $match[2];
return $this;
}
if (!preg_match('/^`([^`]+)`[\s]*([^\s]+(?!\()|[^)]+\))\s*([^,]*?)(DEFAULT\s+([^,]+)|AUTO_INCREMENT)?,?$/', $stmt, $match)) {
if (!preg_match('/^`([^`]+)`[\s]*([^\s]+(?!\()|[^)]+\))\s*([^,]*?)(DEFAULT\s+([^,]+)|AUTO_INCREMENT|COMMENT\s.+)?,?$/', $stmt, $match)) {
throw new \RuntimeException(
sprintf(
'Unable to parse field-definition %s',
Expand Down
4 changes: 2 additions & 2 deletions tests/_data/table.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
CREATE TABLE `foobar` (
`foobar_id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
`foobar_id` INT(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'foobar, bar',
`foo_name` VARCHAR(255) DEFAULT NULL,
`bar_txt` text DEFAULT NULL,
`sex` tinyint(1) NOT NULL DEFAULT 1,
`notes` mediumtext,
`notes` mediumtext COMMENT 'perfect col, with mediumtext',
`created` datetime NOT NULL,
PRIMARY KEY (`foobar_id`),
KEY `name` (`foo_name`)
Expand Down

0 comments on commit 1a21f0e

Please sign in to comment.