mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-27 15:24:51 +09:00
Give each project an inbox in DB
This commit is contained in:
parent
f70aa42060
commit
f4e324e587
6 changed files with 42 additions and 1 deletions
|
@ -213,8 +213,10 @@ Project
|
||||||
wiki RepoId Maybe
|
wiki RepoId Maybe
|
||||||
collabUser RoleId Maybe
|
collabUser RoleId Maybe
|
||||||
collabAnon RoleId Maybe
|
collabAnon RoleId Maybe
|
||||||
|
inbox InboxId
|
||||||
|
|
||||||
UniqueProject ident sharer
|
UniqueProject ident sharer
|
||||||
|
UniqueProjectInbox inbox
|
||||||
|
|
||||||
Repo
|
Repo
|
||||||
ident RpIdent
|
ident RpIdent
|
||||||
|
|
15
migrations/2019_06_09.model
Normal file
15
migrations/2019_06_09.model
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
Inbox
|
||||||
|
|
||||||
|
Project
|
||||||
|
ident PrjIdent
|
||||||
|
sharer Int64
|
||||||
|
name Text Maybe
|
||||||
|
desc Text Maybe
|
||||||
|
workflow Int64
|
||||||
|
nextTicket Int
|
||||||
|
wiki Int64 Maybe
|
||||||
|
collabUser Int64 Maybe
|
||||||
|
collabAnon Int64 Maybe
|
||||||
|
inbox InboxId
|
||||||
|
|
||||||
|
UniqueProject ident sharer
|
|
@ -115,6 +115,7 @@ editProjectAForm sid (Entity jid project) = Project
|
||||||
<*> aopt selectWiki "Wiki" (Just $ projectWiki project)
|
<*> aopt selectWiki "Wiki" (Just $ projectWiki project)
|
||||||
<*> aopt selectRole "User role" (Just $ projectCollabUser project)
|
<*> aopt selectRole "User role" (Just $ projectCollabUser project)
|
||||||
<*> aopt selectRole "Guest role" (Just $ projectCollabAnon project)
|
<*> aopt selectRole "Guest role" (Just $ projectCollabAnon project)
|
||||||
|
<*> pure (projectInbox project)
|
||||||
where
|
where
|
||||||
selectWiki =
|
selectWiki =
|
||||||
selectField $
|
selectField $
|
||||||
|
|
|
@ -77,6 +77,7 @@ postProjectsR shr = do
|
||||||
FormSuccess np -> do
|
FormSuccess np -> do
|
||||||
pid <- requireAuthId
|
pid <- requireAuthId
|
||||||
runDB $ do
|
runDB $ do
|
||||||
|
ibid <- insert Inbox
|
||||||
let project = Project
|
let project = Project
|
||||||
{ projectIdent = npIdent np
|
{ projectIdent = npIdent np
|
||||||
, projectSharer = sid
|
, projectSharer = sid
|
||||||
|
@ -87,6 +88,7 @@ postProjectsR shr = do
|
||||||
, projectWiki = Nothing
|
, projectWiki = Nothing
|
||||||
, projectCollabAnon = Nothing
|
, projectCollabAnon = Nothing
|
||||||
, projectCollabUser = Nothing
|
, projectCollabUser = Nothing
|
||||||
|
, projectInbox = ibid
|
||||||
}
|
}
|
||||||
jid <- insert project
|
jid <- insert project
|
||||||
let collab = ProjectCollab
|
let collab = ProjectCollab
|
||||||
|
|
|
@ -595,9 +595,25 @@ changes hLocal ctx =
|
||||||
Unique "UniqueInboxItemRemote" ["inbox", "activity"]
|
Unique "UniqueInboxItemRemote" ["inbox", "activity"]
|
||||||
-- 105
|
-- 105
|
||||||
, addUnique "Person" $ Unique "UniquePersonInbox" ["inbox"]
|
, addUnique "Person" $ Unique "UniquePersonInbox" ["inbox"]
|
||||||
|
-- 106
|
||||||
|
, addFieldRefRequired'
|
||||||
|
"Project"
|
||||||
|
Inbox20190609
|
||||||
|
(Just $ do
|
||||||
|
jids <- selectKeysList ([] :: [Filter Project20190609]) []
|
||||||
|
for_ jids $ \ jid -> do
|
||||||
|
ibid <- insert Inbox20190609
|
||||||
|
update jid [Project20190609Inbox =. ibid]
|
||||||
|
)
|
||||||
|
"inbox"
|
||||||
|
"Inbox"
|
||||||
|
-- 107
|
||||||
|
, addUnique "Project" $ Unique "UniqueProjectInbox" ["inbox"]
|
||||||
]
|
]
|
||||||
|
|
||||||
migrateDB :: MonadIO m => Text -> HashidsContext -> ReaderT SqlBackend m (Either Text (Int, Int))
|
migrateDB
|
||||||
|
:: MonadIO m
|
||||||
|
=> Text -> HashidsContext -> ReaderT SqlBackend m (Either Text (Int, Int))
|
||||||
migrateDB hLocal ctx =
|
migrateDB hLocal ctx =
|
||||||
let f cs = fmap (, length cs) <$> runMigrations schemaBackend 1 cs
|
let f cs = fmap (, length cs) <$> runMigrations schemaBackend 1 cs
|
||||||
in f $ changes hLocal ctx
|
in f $ changes hLocal ctx
|
||||||
|
|
|
@ -68,6 +68,8 @@ module Vervis.Migration.Model
|
||||||
, InboxItemLocal20190607
|
, InboxItemLocal20190607
|
||||||
, InboxItemRemote20190607Generic (..)
|
, InboxItemRemote20190607Generic (..)
|
||||||
, InboxItemRemote20190607
|
, InboxItemRemote20190607
|
||||||
|
, Project20190609
|
||||||
|
, Inbox20190609Generic (..)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
@ -166,3 +168,6 @@ makeEntitiesMigration "20190606"
|
||||||
|
|
||||||
makeEntitiesMigration "20190607"
|
makeEntitiesMigration "20190607"
|
||||||
$(modelFile "migrations/2019_06_07.model")
|
$(modelFile "migrations/2019_06_07.model")
|
||||||
|
|
||||||
|
makeEntitiesMigration "20190609"
|
||||||
|
$(modelFile "migrations/2019_06_09.model")
|
||||||
|
|
Loading…
Reference in a new issue