diff options
author | Hugues Peccatte <hugues.peccatte@aareon.fr> | 2019-10-28 23:26:05 +0100 |
---|---|---|
committer | William Desportes <williamdes@wdes.fr> | 2019-10-28 23:30:31 +0100 |
commit | e517fbbcaa58bbd1edf0921e3c0b7854caa28df5 (patch) | |
tree | 8a36440c1b03c92f9db1efc8cb8f22c3eb0e7487 /tests | |
parent | b35c21f82e7202d739f6349a583b11e6d32b2b64 (diff) | |
download | sql-parser-e517fbbcaa58bbd1edf0921e3c0b7854caa28df5.zip sql-parser-e517fbbcaa58bbd1edf0921e3c0b7854caa28df5.tar.gz sql-parser-e517fbbcaa58bbd1edf0921e3c0b7854caa28df5.tar.bz2 |
Manage "CHECK" keyword
Even if this keyword is ignored by MySQL, it should be parsed.
Ref: #167
Signed-off-by: Hugues Peccatte <hugues.peccatte@aareon.fr>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Components/CreateDefinitionTest.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/Components/CreateDefinitionTest.php b/tests/Components/CreateDefinitionTest.php index 3683e29..d00feea 100644 --- a/tests/Components/CreateDefinitionTest.php +++ b/tests/Components/CreateDefinitionTest.php @@ -63,4 +63,20 @@ class CreateDefinitionTest extends TestCase CreateDefinition::build($parser->statements[0]->fields[1]) ); } + + public function testBuild2() + { + $parser = new Parser( + 'CREATE TABLE `payment` (' . + '-- snippet' . "\n" . + '`customer_id` smallint(5) unsigned NOT NULL,' . + '`customer_data` longtext CHARACTER SET utf8mb4 CHARSET utf8mb4_bin NOT NULL CHECK (json_valid(customer_data)),' . + 'CONSTRAINT `fk_payment_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE' . + ') ENGINE=InnoDB"' + ); + $this->assertEquals( + 'CONSTRAINT `fk_payment_customer` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE', + CreateDefinition::build($parser->statements[0]->fields[2]) + ); + } } |