Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite and MySQL parser to understand CHECK with parens #123

Merged
merged 7 commits into from
Apr 6, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/SQL/Translator/Parser/MySQL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,11 @@ default_val :
{
$return = $item[2];
}
|
/default/i NAME # column value, allowed in MariaDB
{
$return = $item[2];
}

auto_inc : /auto_increment/i { 1 }

Expand Down
12 changes: 6 additions & 6 deletions t/data/mysql/create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ create table person (
age integer,
weight double(11,2),
iq tinyint default '0',
description text,
description text default `name`,
UNIQUE KEY UC_age_name (age)
) ENGINE=MyISAM;

create unique index u_name on person (name);

create table employee (
position varchar(50),
employee_id integer,
position varchar(50),
employee_id integer,
job_title varchar(255),
CONSTRAINT FK5302D47D93FE702E FOREIGN KEY (employee_id) REFERENCES person (person_id),
CONSTRAINT `demo_constraint` CHECK (`employee_id` > 0 and `employee_id` IS NOT NULL),
PRIMARY KEY (position, employee_id) USING BTREE
CONSTRAINT FK5302D47D93FE702E FOREIGN KEY (employee_id) REFERENCES person (person_id),
CONSTRAINT `demo_constraint` CHECK (`employee_id` > 0 and `employee_id` IS NOT NULL),
PRIMARY KEY (position, employee_id) USING BTREE
) ENGINE=InnoDB;

create table deleted (
Expand Down