Remove Discussion's nextMessage field, it's not being used anymore

This commit is contained in:
fr33domlover 2019-03-18 20:18:25 +00:00
parent 4b351ef62e
commit e0de4cdcc7
4 changed files with 8 additions and 8 deletions

View file

@ -218,7 +218,6 @@ TicketClaimRequest
UniqueTicketClaimRequest person ticket UniqueTicketClaimRequest person ticket
Discussion Discussion
nextMessage Int
Message Message
author PersonId author PersonId

View file

@ -133,10 +133,7 @@ postTicketsR shar proj = do
now <- liftIO getCurrentTime now <- liftIO getCurrentTime
tnum <- runDB $ do tnum <- runDB $ do
update pid [ProjectNextTicket +=. 1] update pid [ProjectNextTicket +=. 1]
let discussion = Discussion did <- insert Discussion
{ discussionNextMessage = 1
}
did <- insert discussion
let ticket = Ticket let ticket = Ticket
{ ticketProject = pid { ticketProject = pid
, ticketNumber = projectNextTicket project , ticketNumber = projectNextTicket project

View file

@ -197,6 +197,8 @@ changes =
, removeUnique "Message" "UniqueMessage" , removeUnique "Message" "UniqueMessage"
-- 44 -- 44
, removeField "Message" "number" , removeField "Message" "number"
-- 45
, removeField "Discussion" "nextMessage"
] ]
migrateDB :: MonadIO m => ReaderT SqlBackend m (Either Text (Int, Int)) migrateDB :: MonadIO m => ReaderT SqlBackend m (Either Text (Int, Int))

View file

@ -1,6 +1,6 @@
{- This file is part of Vervis. {- This file is part of Vervis.
- -
- Written in 2016, 2018 by fr33domlover <fr33domlover@riseup.net>. - Written in 2016, 2018, 2019 by fr33domlover <fr33domlover@riseup.net>.
- -
- Copying is an act of love. Please copy, reuse and share. - Copying is an act of love. Please copy, reuse and share.
- -
@ -58,11 +58,13 @@ getTicketSummaries mfilt morder jid = do
, tsComments = r , tsComments = r
} }
fmap (map toSummary) $ select $ from $ fmap (map toSummary) $ select $ from $
\ (t `InnerJoin` p `InnerJoin` s `InnerJoin` d) -> do \ (t `InnerJoin` p `InnerJoin` s `InnerJoin` d `LeftOuterJoin` m) -> do
on $ just (d ^. DiscussionId) ==. m ?. MessageRoot
on $ t ^. TicketDiscuss ==. d ^. DiscussionId on $ t ^. TicketDiscuss ==. d ^. DiscussionId
on $ p ^. PersonIdent ==. s ^. SharerId on $ p ^. PersonIdent ==. s ^. SharerId
on $ t ^. TicketCreator ==. p ^. PersonId on $ t ^. TicketCreator ==. p ^. PersonId
where_ $ t ^. TicketProject ==. val jid where_ $ t ^. TicketProject ==. val jid
groupBy $ d ^. DiscussionId
for_ mfilt $ \ filt -> where_ $ filt t for_ mfilt $ \ filt -> where_ $ filt t
for_ morder $ \ order -> orderBy $ order t for_ morder $ \ order -> orderBy $ order t
return return
@ -71,7 +73,7 @@ getTicketSummaries mfilt morder jid = do
, t ^. TicketCreated , t ^. TicketCreated
, t ^. TicketTitle , t ^. TicketTitle
, t ^. TicketStatus , t ^. TicketStatus
, d ^. DiscussionNextMessage -. val 1 , count $ m ?. MessageId
) )
-- | Get the child-parent ticket number pairs of all the ticket dependencies -- | Get the child-parent ticket number pairs of all the ticket dependencies