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
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
|]