Define data model using persistent's TH

This commit is contained in:
fr33domlover 2016-02-09 21:07:01 +00:00
parent b7aa7ec45d
commit d2e78b4c51

View file

@ -29,17 +29,38 @@ module Vervis.Persist
where where
import Control.Monad.IO.Class (liftIO) import Control.Monad.IO.Class (liftIO)
import Data.Text (Text)
import Database.Persist import Database.Persist
import Database.Persist.Sqlite import Database.Persist.Sqlite
import Database.Persist.TH import Database.Persist.TH
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase| share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
Person
name String IrcChannel
age Int Maybe network Text
deriving Show name Text
BlogPost User
title String ident Text --CI
authorId PersonId hash Text Maybe
deriving Show 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
|] |]