2024-01-09 01:07:47 +01:00
|
|
|
|
2024-01-10 08:40:24 +01:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2024-01-09 01:07:47 +01:00
|
|
|
module Language.SQL.SimpleSQL.CreateIndex where
|
|
|
|
|
|
|
|
import Language.SQL.SimpleSQL.Syntax
|
|
|
|
import Language.SQL.SimpleSQL.TestTypes
|
2024-02-04 17:00:59 +01:00
|
|
|
import Language.SQL.SimpleSQL.TestRunners
|
|
|
|
import Data.Text (Text)
|
2024-01-09 01:07:47 +01:00
|
|
|
|
|
|
|
createIndexTests :: TestItem
|
|
|
|
createIndexTests = Group "create index tests"
|
2024-02-04 17:00:59 +01:00
|
|
|
[s "create index a on tbl(c1)"
|
2024-01-09 01:07:47 +01:00
|
|
|
$ CreateIndex False [nm "a"] [nm "tbl"] [nm "c1"]
|
2024-02-04 17:00:59 +01:00
|
|
|
,s "create index a.b on sc.tbl (c1, c2)"
|
2024-01-09 01:07:47 +01:00
|
|
|
$ CreateIndex False [nm "a", nm "b"] [nm "sc", nm "tbl"] [nm "c1", nm "c2"]
|
2024-02-04 17:00:59 +01:00
|
|
|
,s "create unique index a on tbl(c1)"
|
2024-01-09 01:07:47 +01:00
|
|
|
$ CreateIndex True [nm "a"] [nm "tbl"] [nm "c1"]
|
|
|
|
]
|
|
|
|
where
|
|
|
|
nm = Name Nothing
|
2024-02-04 17:00:59 +01:00
|
|
|
s :: HasCallStack => Text -> Statement -> TestItem
|
|
|
|
s src ast = testStatement ansi2011 src ast
|