@@ -38,6 +38,7 @@ type Schema =
3838 , "user_id" ::: 'NoDef :=> 'NotNull 'PGint4
3939 , "email" ::: 'NoDef :=> 'Null 'PGtext
4040 ])
41+ , "positive" ::: 'Typedef 'PGfloat4
4142 ]
4243
4344type Schemas = Public Schema
@@ -57,9 +58,11 @@ setup =
5758 ( primaryKey #id `as` #pk_emails :*
5859 foreignKey #user_id #users #id
5960 OnDeleteCascade OnUpdateCascade `as` #fk_user_id )
61+ >>>
62+ createDomain #positive real (#value .> 0 .&& (#value & isNotNull))
6063
6164teardown :: Definition Schemas (Public '[])
62−teardown = dropTable #emails >>> dropTable #users
65+teardown = dropType #positive >>> dropTable #emails >>> dropTable #users
6366
6467insertUser :: Manipulation_ Schemas (Text, VarArray (Vector (Maybe Int16))) (Only Int32)
6568insertUser = insertInto #users