DB: Remove unnecessary fkey from TicketAuthorRemote to Ticket
Since it points to TicketProjectLocal which in turn points to Ticket.
This commit is contained in:
parent
5b57039447
commit
6e2445a31f
5 changed files with 20 additions and 10 deletions
|
@ -381,13 +381,11 @@ TicketAuthorLocal
|
|||
UniqueTicketAuthorLocalOffer offer
|
||||
|
||||
TicketAuthorRemote
|
||||
ticket TicketId
|
||||
ticketNew TicketProjectLocalId
|
||||
ticket TicketProjectLocalId
|
||||
author RemoteActorId
|
||||
offer RemoteActivityId
|
||||
|
||||
UniqueTicketAuthorRemote ticket
|
||||
UniqueTicketAuthorRemoteNew ticketNew
|
||||
UniqueTicketAuthorRemote ticket
|
||||
UniqueTicketAuthorRemoteOffer offer
|
||||
|
||||
TicketDependency
|
||||
|
|
|
@ -284,8 +284,7 @@ projectOfferTicketF
|
|||
, ticketProjectLocalAccept = obiidAccept
|
||||
}
|
||||
insert_ TicketAuthorRemote
|
||||
{ ticketAuthorRemoteTicket = tid
|
||||
, ticketAuthorRemoteTicketNew = tplid
|
||||
{ ticketAuthorRemoteTicket = tplid
|
||||
, ticketAuthorRemoteAuthor = raidAuthor
|
||||
, ticketAuthorRemoteOffer = ractid
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ getTicketR shar proj ltkhid = do
|
|||
ltid <- decodeKeyHashid404 ltkhid
|
||||
lticket <- get404 ltid
|
||||
let tid = localTicketTicket lticket
|
||||
tpl <- getValBy404 $ UniqueTicketProjectLocal tid
|
||||
Entity tplid tpl <- getBy404 $ UniqueTicketProjectLocal tid
|
||||
unless (ticketProjectLocalProject tpl == jid) notFound
|
||||
author <-
|
||||
requireEitherAlt
|
||||
|
@ -269,7 +269,7 @@ getTicketR shar proj ltkhid = do
|
|||
p <- getJust $ ticketAuthorLocalAuthor tal
|
||||
getJust $ personIdent p
|
||||
)
|
||||
(do mtar <- getValBy $ UniqueTicketAuthorRemote tid
|
||||
(do mtar <- getValBy $ UniqueTicketAuthorRemote tplid
|
||||
for mtar $ \ tar -> do
|
||||
ra <- getJust $ ticketAuthorRemoteAuthor tar
|
||||
ro <- getJust $ remoteActorIdent ra
|
||||
|
@ -954,16 +954,18 @@ getTicketDeps forward shr prj ltkhid = do
|
|||
\ ( td
|
||||
`E.InnerJoin` t
|
||||
`E.InnerJoin` lt
|
||||
`E.InnerJoin` tpl
|
||||
`E.LeftOuterJoin` (tal `E.InnerJoin` p `E.InnerJoin` s)
|
||||
`E.LeftOuterJoin` (tar `E.InnerJoin` ra `E.InnerJoin` ro `E.InnerJoin` i)
|
||||
) -> do
|
||||
E.on $ ro E.?. RemoteObjectInstance E.==. i E.?. InstanceId
|
||||
E.on $ ra E.?. RemoteActorIdent E.==. ro E.?. RemoteObjectId
|
||||
E.on $ tar E.?. TicketAuthorRemoteAuthor E.==. ra E.?. RemoteActorId
|
||||
E.on $ E.just (t E.^. TicketId) E.==. tar E.?. TicketAuthorRemoteTicket
|
||||
E.on $ E.just (tpl E.^. TicketProjectLocalId) E.==. tar E.?. TicketAuthorRemoteTicket
|
||||
E.on $ p E.?. PersonIdent E.==. s E.?. SharerId
|
||||
E.on $ tal E.?. TicketAuthorLocalAuthor E.==. p E.?. PersonId
|
||||
E.on $ E.just (lt E.^. LocalTicketId) E.==. tal E.?. TicketAuthorLocalTicket
|
||||
E.on $ t E.^. TicketId E.==. tpl E.^. TicketProjectLocalTicket
|
||||
E.on $ t E.^. TicketId E.==. lt E.^. LocalTicketTicket
|
||||
E.on $ td E.^. to' E.==. t E.^. TicketId
|
||||
E.where_ $ td E.^. from' E.==. E.val tid
|
||||
|
|
|
@ -1396,6 +1396,17 @@ changes hLocal ctx =
|
|||
-- 206
|
||||
, addUnique "TicketAuthorRemote" $
|
||||
Unique "UniqueTicketAuthorRemoteNew" ["ticketNew"]
|
||||
-- 207
|
||||
, removeUnique "TicketAuthorRemote" "UniqueTicketAuthorRemote"
|
||||
-- 208
|
||||
, removeField "TicketAuthorRemote" "ticket"
|
||||
-- 209
|
||||
, renameUnique
|
||||
"TicketAuthorRemote"
|
||||
"UniqueTicketAuthorRemoteNew"
|
||||
"UniqueTicketAuthorRemote"
|
||||
-- 210
|
||||
, renameField "TicketAuthorRemote" "ticketNew" "ticket"
|
||||
]
|
||||
|
||||
migrateDB
|
||||
|
|
|
@ -65,7 +65,7 @@ getTicketSummaries mfilt morder offlim jid = do
|
|||
on $ ro ?. RemoteObjectInstance ==. i ?. InstanceId
|
||||
on $ ra ?. RemoteActorIdent ==. ro ?. RemoteObjectId
|
||||
on $ tar ?. TicketAuthorRemoteAuthor ==. ra ?. RemoteActorId
|
||||
on $ just (t ^. TicketId) ==. tar ?. TicketAuthorRemoteTicket
|
||||
on $ just (tpl ^. TicketProjectLocalId) ==. tar ?. TicketAuthorRemoteTicket
|
||||
on $ p ?. PersonIdent ==. s ?. SharerId
|
||||
on $ tal ?. TicketAuthorLocalAuthor ==. p ?. PersonId
|
||||
on $ just (lt ^. LocalTicketId) ==. tal ?. TicketAuthorLocalTicket
|
||||
|
|
Loading…
Reference in a new issue