Accept some additional SQL types
Still far from complete ...
This commit is contained in:
parent
15e558c90b
commit
33b680c49b
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = ProcruSQL
|
name = ProcruSQL
|
||||||
version = 0.0.3
|
version = 0.0.4
|
||||||
author = Peter J. Holzer
|
author = Peter J. Holzer
|
||||||
author_email = hjp@hjp.at
|
author_email = hjp@hjp.at
|
||||||
description = Make a database fit its description
|
description = Make a database fit its description
|
||||||
|
|
|
@ -212,7 +212,14 @@ def parse_column_definition(ps):
|
||||||
ps2 = ps.clone()
|
ps2 = ps.clone()
|
||||||
ps2.ast = []
|
ps2.ast = []
|
||||||
ps2.skip_whitespace_and_comments()
|
ps2.skip_whitespace_and_comments()
|
||||||
m = ps2.match(r"(int|serial|text|boolean)(\s+not null)?(\s+(primary key|unique|references \w+))?\b")
|
sqltypes = (
|
||||||
|
"int", "integer", "serial",
|
||||||
|
"boolean",
|
||||||
|
"text", "character varying",
|
||||||
|
"date", "timestamp with time zone", "timestamptz"
|
||||||
|
)
|
||||||
|
pattern = "(" + "|".join(sqltypes) + ")" + r"(\s+default .*)?(\s+not null)?(\s+(primary key|unique|references \w+))?\b"
|
||||||
|
m = ps2.match(pattern)
|
||||||
if not m:
|
if not m:
|
||||||
ps.record_child_failure(ps2, "expected column definition")
|
ps.record_child_failure(ps2, "expected column definition")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue