From bfa1b40b21e477b1e0f6712a2bab98983ebae85f Mon Sep 17 00:00:00 2001 From: Greyson Fischer Date: Tue, 7 Apr 2020 14:25:10 -0400 Subject: [PATCH] Added (normally defaulted) `NULL` column constraint --- Language/SQL/SimpleSQL/Parse.lhs | 3 ++- Language/SQL/SimpleSQL/Syntax.lhs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Language/SQL/SimpleSQL/Parse.lhs b/Language/SQL/SimpleSQL/Parse.lhs index ba5f684..82cd780 100644 --- a/Language/SQL/SimpleSQL/Parse.lhs +++ b/Language/SQL/SimpleSQL/Parse.lhs @@ -1564,8 +1564,9 @@ TODO: change style > colConstraintDef = > ColConstraintDef > <$> (optionMaybe (keyword_ "constraint" *> names)) -> <*> (notNull <|> unique <|> primaryKey <|> check <|> references) +> <*> (nullable <|> notNull <|> unique <|> primaryKey <|> check <|> references) > where +> nullable = ColNullableConstraint <$ keyword "null" > notNull = ColNotNullConstraint <$ keywords_ ["not", "null"] > unique = ColUniqueConstraint <$ keyword_ "unique" > primaryKey = ColPrimaryKeyConstraint <$ keywords_ ["primary", "key"] diff --git a/Language/SQL/SimpleSQL/Syntax.lhs b/Language/SQL/SimpleSQL/Syntax.lhs index 22d61c8..3dfd440 100644 --- a/Language/SQL/SimpleSQL/Syntax.lhs +++ b/Language/SQL/SimpleSQL/Syntax.lhs @@ -571,7 +571,8 @@ I'm not sure if this is valid syntax or not. > deriving (Eq,Show,Read,Data,Typeable) > data ColConstraint = -> ColNotNullConstraint +> ColNullableConstraint +> | ColNotNullConstraint > | ColUniqueConstraint > | ColPrimaryKeyConstraint > | ColReferencesConstraint [Name] (Maybe Name)