mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-27 18:34:52 +09:00
Define data model using persistent's TH
This commit is contained in:
parent
b7aa7ec45d
commit
d2e78b4c51
1 changed files with 29 additions and 8 deletions
|
@ -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
|
||||
|]
|
||||
|
|
Loading…
Reference in a new issue