on master help sign in
add uniqueness constraint to blog
commitf0d2499dfbf822e400b05c2cb91988a4fdb304c5 authorAgentM <agentm@themactionfaction.com> dateSun 8 Oct 2017, 18:50 (9 years ago) parenta947f18
1 file changed+3−1
examples/blog.hs+3−1
examples/blog.hs+3−1
@@ -93,7 +93,9 @@ createSchema sessionId conn = do
9393 toAddTypeExpr (Proxy :: Proxy Category),
9494 toDefineExpr (Proxy :: Proxy Blog) "blog",
9595 toDefineExpr (Proxy :: Proxy Comment) "comment",
96− databaseContextExprForForeignKey "blog_comment" ("comment", ["blogTitle"]) ("blog", ["title"]) ]
96+ databaseContextExprForForeignKey "blog_comment" ("comment", ["blogTitle"]) ("blog", ["title"]),
97+ databaseContextExprForUniqueKey "blog" ["title"]
98+ ]
9799 pure ()
98100
99101--create some sample values and insert them into the database's relation variables