2016-02-06 22:36:35 +09:00
|
|
|
{- This file is part of Vervis.
|
|
|
|
-
|
|
|
|
- Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
|
|
|
|
-
|
|
|
|
- ♡ Copying is an act of love. Please copy, reuse and share.
|
|
|
|
-
|
|
|
|
- The author(s) have dedicated all copyright and related and neighboring
|
|
|
|
- rights to this software to the public domain worldwide. This software is
|
|
|
|
- distributed without any warranty.
|
|
|
|
-
|
|
|
|
- You should have received a copy of the CC0 Public Domain Dedication along
|
|
|
|
- with this software. If not, see
|
|
|
|
- <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|
|
|
-}
|
|
|
|
|
|
|
|
{-# LANGUAGE EmptyDataDecls #-}
|
|
|
|
{-# LANGUAGE FlexibleContexts #-}
|
|
|
|
{-# LANGUAGE GADTs #-}
|
|
|
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
|
|
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
{-# LANGUAGE QuasiQuotes #-}
|
|
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
{-# LANGUAGE TypeFamilies #-}
|
|
|
|
|
|
|
|
module Vervis.Persist
|
|
|
|
--(
|
|
|
|
--)
|
|
|
|
where
|
|
|
|
|
|
|
|
import Control.Monad.IO.Class (liftIO)
|
2016-02-10 06:07:01 +09:00
|
|
|
import Data.Text (Text)
|
2016-02-06 22:36:35 +09:00
|
|
|
import Database.Persist
|
|
|
|
import Database.Persist.Sqlite
|
|
|
|
import Database.Persist.TH
|
|
|
|
|
|
|
|
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
|
2016-02-10 06:07:01 +09:00
|
|
|
|
|
|
|
IrcChannel
|
|
|
|
network Text
|
|
|
|
name Text
|
2016-02-11 18:36:24 +09:00
|
|
|
|
|
|
|
Sharer
|
2016-02-10 06:07:01 +09:00
|
|
|
ident Text --CI
|
|
|
|
name Text Maybe
|
2016-02-11 18:36:24 +09:00
|
|
|
|
|
|
|
UniqueIdent ident
|
|
|
|
|
|
|
|
Person
|
|
|
|
ident SharerId
|
|
|
|
hash Text Maybe
|
|
|
|
email Text Maybe
|
|
|
|
|
|
|
|
UniquePersonIdent ident
|
|
|
|
|
2016-02-10 06:07:01 +09:00
|
|
|
Group
|
2016-02-11 18:36:24 +09:00
|
|
|
ident SharerId
|
|
|
|
|
|
|
|
UniqueGroupIdent ident
|
|
|
|
|
2016-02-10 06:07:01 +09:00
|
|
|
Project
|
2016-02-11 18:36:24 +09:00
|
|
|
ident Text --CI
|
|
|
|
sharer SharerId
|
|
|
|
name Text Maybe
|
|
|
|
desc Text Maybe
|
2016-02-10 06:07:01 +09:00
|
|
|
|
2016-02-11 18:36:24 +09:00
|
|
|
UniqueProject ident sharer
|
2016-02-10 06:07:01 +09:00
|
|
|
|
2016-02-11 18:36:24 +09:00
|
|
|
Repo
|
|
|
|
name Text --CI
|
2016-02-10 06:07:01 +09:00
|
|
|
project ProjectId
|
2016-02-11 18:36:24 +09:00
|
|
|
irc IrcChannelId Maybe
|
|
|
|
ml Text Maybe
|
|
|
|
|
|
|
|
UniqueRepo name project
|
|
|
|
|
|
|
|
PersonInGroup
|
|
|
|
person PersonId
|
|
|
|
group GroupId
|
|
|
|
|
|
|
|
UniquePersonInGroup person group
|
|
|
|
|
2016-02-06 22:36:35 +09:00
|
|
|
|]
|
2016-02-11 18:36:24 +09:00
|
|
|
|
|
|
|
--mainViewQuery = --TODO
|