1
Fork 0

Added (normally defaulted) NULL column constraint

This commit is contained in:
Greyson Fischer 2020-04-07 14:25:10 -04:00
parent 8accc62cef
commit bfa1b40b21
2 changed files with 4 additions and 2 deletions

View file

@ -1564,8 +1564,9 @@ TODO: change style
> colConstraintDef = > colConstraintDef =
> ColConstraintDef > ColConstraintDef
> <$> (optionMaybe (keyword_ "constraint" *> names)) > <$> (optionMaybe (keyword_ "constraint" *> names))
> <*> (notNull <|> unique <|> primaryKey <|> check <|> references) > <*> (nullable <|> notNull <|> unique <|> primaryKey <|> check <|> references)
> where > where
> nullable = ColNullableConstraint <$ keyword "null"
> notNull = ColNotNullConstraint <$ keywords_ ["not", "null"] > notNull = ColNotNullConstraint <$ keywords_ ["not", "null"]
> unique = ColUniqueConstraint <$ keyword_ "unique" > unique = ColUniqueConstraint <$ keyword_ "unique"
> primaryKey = ColPrimaryKeyConstraint <$ keywords_ ["primary", "key"] > primaryKey = ColPrimaryKeyConstraint <$ keywords_ ["primary", "key"]

View file

@ -571,7 +571,8 @@ I'm not sure if this is valid syntax or not.
> deriving (Eq,Show,Read,Data,Typeable) > deriving (Eq,Show,Read,Data,Typeable)
> data ColConstraint = > data ColConstraint =
> ColNotNullConstraint > ColNullableConstraint
> | ColNotNullConstraint
> | ColUniqueConstraint > | ColUniqueConstraint
> | ColPrimaryKeyConstraint > | ColPrimaryKeyConstraint
> | ColReferencesConstraint [Name] (Maybe Name) > | ColReferencesConstraint [Name] (Maybe Name)