Compare commits
2 Commits
6c3437a5f1
...
f6c64a50ab
Author | SHA1 | Date |
---|---|---|
Peter J. Holzer | f6c64a50ab | |
Peter J. Holzer | ccf10d5690 |
|
@ -1,6 +1,6 @@
|
|||
[metadata]
|
||||
name = ProcruSQL
|
||||
version = 0.0.12
|
||||
version = 0.0.14
|
||||
author = Peter J. Holzer
|
||||
author_email = hjp@hjp.at
|
||||
description = Make a database fit its description
|
||||
|
|
|
@ -285,15 +285,20 @@ def parse_column_definition(ps):
|
|||
ps2 = ps.clone()
|
||||
ps2.ast = []
|
||||
ps2.skip_whitespace_and_comments()
|
||||
sqltypes = (
|
||||
"integer", "int", "serial", "bigint",
|
||||
"boolean",
|
||||
"text", "character varying",
|
||||
"date", "timestamp with time zone", "timestamptz",
|
||||
"time",
|
||||
"inet",
|
||||
"double precision", "float8", "real", "float4",
|
||||
"json", "jsonb",
|
||||
sqltypes = sorted(
|
||||
(
|
||||
"integer", "int", "serial", "bigint",
|
||||
"boolean",
|
||||
"text", "character varying",
|
||||
"date", "timestamp with time zone", "timestamptz",
|
||||
"time",
|
||||
"inet",
|
||||
"double precision", "float8", "real", "float4",
|
||||
"json", "jsonb",
|
||||
"uuid",
|
||||
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))*"
|
||||
m = ps2.match(pattern)
|
||||
|
|
Loading…
Reference in New Issue