0
0
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:
Roland Bock 2022-04-09 21:47:21 +02:00
parent 1d5caca523
commit b50cc454b6
2 changed files with 4 additions and 3 deletions

View File

@ -259,7 +259,7 @@ ddlCreateTable = pp.Group(
+ pp.Suppress(pp.Optional(ddlIfNotExists))
+ ddlName.setResultsName("tableName")
+ ddlLeft
+ pp.Group(pp.delimitedList(ddlColumn | pp.Suppress(ddlConstraint))).setResultsName(
+ pp.Group(pp.delimitedList(pp.Suppress(ddlConstraint) | ddlColumn)).setResultsName(
"columns"
)
+ ddlRight

View File

@ -28,12 +28,13 @@ CREATE TABLE tab_foo
(
delta varchar(255),
_epsilon bigint,
`omega` double
`omega` double,
CONSTRAINT uc_delta UNIQUE (delta, _epsilon)
);
CREATE TABLE tab_bar
(
alpha bigint AUTO_INCREMENT,
alpha bigint AUTO_INCREMENT RRIMARY_KEY,
beta varchar(255) NULL DEFAULT "",
gamma bool NOT NULL,
delta int