Accept some additional SQL types
Still far from complete ...
This commit is contained in:
parent
15e558c90b
commit
33b680c49b
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = ProcruSQL
|
||||
version = 0.0.3
|
||||
version = 0.0.4
|
||||
author = Peter J. Holzer
|
||||
author_email = hjp@hjp.at
|
||||
description = Make a database fit its description
|
||||
|
|
|
@ -212,7 +212,14 @@ def parse_column_definition(ps):
|
|||
ps2 = ps.clone()
|
||||
ps2.ast = []
|
||||
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:
|
||||
ps.record_child_failure(ps2, "expected column definition")
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue