Add autoincrement option to dialect
This commit is contained in:
parent
c997e3196c
commit
d53afd905e
3 changed files with 8 additions and 2 deletions
Language/SQL/SimpleSQL
|
@ -90,6 +90,8 @@ Data types to represent different dialect options
|
|||
> ,diSqlServerSymbols :: Bool
|
||||
> -- | allow sql server style for CONVERT function in format CONVERT(data_type(length), expression, style)
|
||||
> ,diConvertFunction :: Bool
|
||||
> -- | allow creating autoincrement columns
|
||||
> ,diAutoincrement :: Bool
|
||||
> }
|
||||
> deriving (Eq,Show,Read,Data,Typeable)
|
||||
|
||||
|
@ -112,6 +114,7 @@ Data types to represent different dialect options
|
|||
> ,diPostgresSymbols = False
|
||||
> ,diSqlServerSymbols = False
|
||||
> ,diConvertFunction = False
|
||||
> ,diAutoincrement = False
|
||||
> }
|
||||
|
||||
> -- | mysql dialect
|
||||
|
|
|
@ -1595,7 +1595,10 @@ TODO: change style
|
|||
> unique = ColUniqueConstraint <$ keyword_ "unique"
|
||||
> primaryKey = do
|
||||
> keywords_ ["primary", "key"]
|
||||
> autoincrement <- optionMaybe (keyword_ "autoincrement")
|
||||
> d <- getState
|
||||
> autoincrement <- if diAutoincrement d
|
||||
> then optionMaybe (keyword_ "autoincrement")
|
||||
> else pure Nothing
|
||||
> pure $ ColPrimaryKeyConstraint $ isJust autoincrement
|
||||
> check = keyword_ "check" >> ColCheckConstraint <$> parens scalarExpr
|
||||
> references = keyword_ "references" >>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue