Add integer arrays
This commit is contained in:
parent
6c3437a5f1
commit
ccf10d5690
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = ProcruSQL
|
name = ProcruSQL
|
||||||
version = 0.0.12
|
version = 0.0.13
|
||||||
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
|
||||||
|
|
|
@ -285,15 +285,19 @@ 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()
|
||||||
sqltypes = (
|
sqltypes = sorted(
|
||||||
"integer", "int", "serial", "bigint",
|
(
|
||||||
"boolean",
|
"integer", "int", "serial", "bigint",
|
||||||
"text", "character varying",
|
"boolean",
|
||||||
"date", "timestamp with time zone", "timestamptz",
|
"text", "character varying",
|
||||||
"time",
|
"date", "timestamp with time zone", "timestamptz",
|
||||||
"inet",
|
"time",
|
||||||
"double precision", "float8", "real", "float4",
|
"inet",
|
||||||
"json", "jsonb",
|
"double precision", "float8", "real", "float4",
|
||||||
|
"json", "jsonb",
|
||||||
|
r"integer\[\]", r"int\[\]", r"bigint\[\]",
|
||||||
|
),
|
||||||
|
key=lambda x: -len(x) # longest match first
|
||||||
)
|
)
|
||||||
pattern = "(" + "|".join(sqltypes) + ")" + r"([ \t]+(default .*|not null\b|primary key\b|unique\b|references \w+\b))*"
|
pattern = "(" + "|".join(sqltypes) + ")" + r"([ \t]+(default .*|not null\b|primary key\b|unique\b|references \w+\b))*"
|
||||||
m = ps2.match(pattern)
|
m = ps2.match(pattern)
|
||||||
|
|
Loading…
Reference in New Issue