From d2e78b4c5189b6c89ec37bb378e5af3bcd022468 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Tue, 9 Feb 2016 21:07:01 +0000 Subject: [PATCH] Define data model using persistent's TH --- src/Vervis/Persist.hs | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/src/Vervis/Persist.hs b/src/Vervis/Persist.hs index add78ea..b45bd35 100644 --- a/src/Vervis/Persist.hs +++ b/src/Vervis/Persist.hs @@ -29,17 +29,38 @@ module Vervis.Persist where import Control.Monad.IO.Class (liftIO) +import Data.Text (Text) import Database.Persist import Database.Persist.Sqlite import Database.Persist.TH share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase| -Person - name String - age Int Maybe - deriving Show -BlogPost - title String - authorId PersonId - deriving Show + +IrcChannel + network Text + name Text +User + ident Text --CI + hash Text Maybe + name Text Maybe + email Text Maybe +Group + ident Text --CI + name Text Maybe +Repo + name Text --CI + irc IrcChannelId Maybe + ml Text Maybe +Project + ident Text --CI + name Text Maybe + desc Text Maybe + +UserInGroup + user UserId + group GroupId + +RepoInProject + repo RepoId + project ProjectId |]