on dev help sign in
Add non-compiling createDomain to Example program

This fails type-checking, but it should work.

commitc135984cda529a27c97eda987139d71eaee86bd2 authorChristopher League <league@contrapunctus.net> dateWed 21 Aug 2019, 11:29 (7 years ago) parent83c711a
1 file changed+4−1
squeal-postgresql/exe/Example.hs+4−1
squeal-postgresql/exe/Example.hs+4−1
@@ -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