mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Fix constraints handling in ddl2cpp (#437)
Constraints got interpreted as (unknown) data types. This change should fix this most cases (simple test case added).
This commit is contained in:
parent
1d5caca523
commit
b50cc454b6
@ -259,7 +259,7 @@ ddlCreateTable = pp.Group(
|
|||||||
+ pp.Suppress(pp.Optional(ddlIfNotExists))
|
+ pp.Suppress(pp.Optional(ddlIfNotExists))
|
||||||
+ ddlName.setResultsName("tableName")
|
+ ddlName.setResultsName("tableName")
|
||||||
+ ddlLeft
|
+ ddlLeft
|
||||||
+ pp.Group(pp.delimitedList(ddlColumn | pp.Suppress(ddlConstraint))).setResultsName(
|
+ pp.Group(pp.delimitedList(pp.Suppress(ddlConstraint) | ddlColumn)).setResultsName(
|
||||||
"columns"
|
"columns"
|
||||||
)
|
)
|
||||||
+ ddlRight
|
+ ddlRight
|
||||||
|
@ -28,12 +28,13 @@ CREATE TABLE tab_foo
|
|||||||
(
|
(
|
||||||
delta varchar(255),
|
delta varchar(255),
|
||||||
_epsilon bigint,
|
_epsilon bigint,
|
||||||
`omega` double
|
`omega` double,
|
||||||
|
CONSTRAINT uc_delta UNIQUE (delta, _epsilon)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE tab_bar
|
CREATE TABLE tab_bar
|
||||||
(
|
(
|
||||||
alpha bigint AUTO_INCREMENT,
|
alpha bigint AUTO_INCREMENT RRIMARY_KEY,
|
||||||
beta varchar(255) NULL DEFAULT "",
|
beta varchar(255) NULL DEFAULT "",
|
||||||
gamma bool NOT NULL,
|
gamma bool NOT NULL,
|
||||||
delta int
|
delta int
|
||||||
|
Loading…
Reference in New Issue
Block a user