1
Fork 0

add schema support for create index referenced table, and add some tests

This commit is contained in:
Jake 2021-10-19 16:32:25 +01:00
parent f019c2d1ed
commit 05481371dd
6 changed files with 34 additions and 3 deletions
Language/SQL/SimpleSQL

View file

@ -1511,7 +1511,7 @@ TODO: change style
> <$> ((keyword_ "index" >> pure False) <|>
> (keywords_ ["unique", "index"] >> pure True))
> <*> names
> <*> (keyword_ "on" >> name)
> <*> (keyword_ "on" >> names)
> <*> parens (commaSep1 name)
> columnDef :: Parser ColumnDef

View file

@ -531,6 +531,15 @@ Try to do this when this code is ported to a modern pretty printing lib.
> statement _ (DropAssertion nm db) =
> text "drop" <+> text "assertion" <+> names nm <+> dropBehav db
> statement _ (CreateIndex un nm tbl cols) =
> texts (if un
> then ["create","unique","index"]
> else ["create","index"])
> <+> names nm
> <+> text "on"
> <+> names tbl
> <+> parens (commaSep $ map name cols)
== dml
> statement d (SelectStatement q) = queryExpr d q

View file

@ -454,7 +454,7 @@ I'm not sure if this is valid syntax or not.
> | CreateTable [Name] [TableElement]
> | AlterTable [Name] AlterTableAction
> | DropTable [Name] DropBehaviour
> | CreateIndex Bool [Name] Name [Name]
> | CreateIndex Bool [Name] [Name] [Name]
> | CreateView Bool [Name] (Maybe [Name])
> QueryExpr (Maybe CheckOption)
> | DropView [Name] DropBehaviour