mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-27 15:24:51 +09:00
DB: Add and populate TicketUnderProject table
A row in this table will be required for local-project-local-author tickets hosted under the project, and non-existence of a row will be required for such tickets hosted by the author. So I'll need to CAREFULLY update all the ticket route handler code and all the ticket related AP code. The latter includes C2S and S2S for tickets, ticket deps, ticket discussion... everything that is under tickets.
This commit is contained in:
parent
7612b4e01e
commit
5e9dd3555d
5 changed files with 63 additions and 0 deletions
|
@ -388,6 +388,12 @@ TicketAuthorRemote
|
||||||
UniqueTicketAuthorRemote ticket
|
UniqueTicketAuthorRemote ticket
|
||||||
UniqueTicketAuthorRemoteOpen open
|
UniqueTicketAuthorRemoteOpen open
|
||||||
|
|
||||||
|
TicketUnderProject
|
||||||
|
project TicketProjectLocalId
|
||||||
|
author TicketAuthorLocalId
|
||||||
|
|
||||||
|
UniqueTicketUnderProject project author
|
||||||
|
|
||||||
TicketDependency
|
TicketDependency
|
||||||
parent TicketId
|
parent TicketId
|
||||||
child TicketId
|
child TicketId
|
||||||
|
|
5
migrations/2020_02_09_tup.model
Normal file
5
migrations/2020_02_09_tup.model
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
TicketUnderProject
|
||||||
|
project TicketProjectLocalId
|
||||||
|
author TicketAuthorLocalId
|
||||||
|
|
||||||
|
UniqueTicketUnderProject project author
|
32
migrations/2020_02_09_tup_mig.model
Normal file
32
migrations/2020_02_09_tup_mig.model
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
Ticket
|
||||||
|
|
||||||
|
LocalTicket
|
||||||
|
ticket TicketId
|
||||||
|
discuss Int64
|
||||||
|
followers Int64
|
||||||
|
|
||||||
|
UniqueLocalTicket ticket
|
||||||
|
UniqueLocalTicketDiscussion discuss
|
||||||
|
UniqueLocalTicketFollowers followers
|
||||||
|
|
||||||
|
TicketProjectLocal
|
||||||
|
ticket TicketId
|
||||||
|
project Int64
|
||||||
|
accept Int64
|
||||||
|
|
||||||
|
UniqueTicketProjectLocal ticket
|
||||||
|
UniqueTicketProjectLocalAccept accept
|
||||||
|
|
||||||
|
TicketAuthorLocal
|
||||||
|
ticket LocalTicketId
|
||||||
|
author Int64
|
||||||
|
open Int64
|
||||||
|
|
||||||
|
UniqueTicketAuthorLocal ticket
|
||||||
|
UniqueTicketAuthorLocalOpen open
|
||||||
|
|
||||||
|
TicketUnderProject
|
||||||
|
project TicketProjectLocalId
|
||||||
|
author TicketAuthorLocalId
|
||||||
|
|
||||||
|
UniqueTicketUnderProject project author
|
|
@ -26,6 +26,7 @@ import Control.Monad.Trans.Class (lift)
|
||||||
import Control.Monad.Trans.Maybe
|
import Control.Monad.Trans.Maybe
|
||||||
import Control.Monad.Trans.Reader (ReaderT, runReaderT)
|
import Control.Monad.Trans.Reader (ReaderT, runReaderT)
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
|
import Data.Bifunctor
|
||||||
import Data.ByteString (ByteString)
|
import Data.ByteString (ByteString)
|
||||||
import Data.Default.Class
|
import Data.Default.Class
|
||||||
import Data.Default.Instances.ByteString ()
|
import Data.Default.Instances.ByteString ()
|
||||||
|
@ -1452,6 +1453,17 @@ changes hLocal ctx =
|
||||||
, removeField "RemoteDiscussion" "ident"
|
, removeField "RemoteDiscussion" "ident"
|
||||||
-- 221
|
-- 221
|
||||||
, renameField "RemoteDiscussion" "identNew" "ident"
|
, renameField "RemoteDiscussion" "identNew" "ident"
|
||||||
|
-- 222
|
||||||
|
, addEntities model_2020_02_09
|
||||||
|
-- 223
|
||||||
|
, unchecked $ lift $ do
|
||||||
|
ids <- E.select $ E.from $
|
||||||
|
\ (tal `E.InnerJoin` lt `E.InnerJoin` t `E.InnerJoin` tpl) -> do
|
||||||
|
E.on $ t E.^. Ticket223Id E.==. tpl E.^. TicketProjectLocal223Ticket
|
||||||
|
E.on $ lt E.^. LocalTicket223Ticket E.==. t E.^. Ticket223Id
|
||||||
|
E.on $ tal E.^. TicketAuthorLocal223Ticket E.==. lt E.^. LocalTicket223Id
|
||||||
|
return (tpl E.^. TicketProjectLocal223Id, tal E.^. TicketAuthorLocal223Id)
|
||||||
|
insertMany_ $ map (uncurry TicketUnderProject223 . bimap E.unValue E.unValue) ids
|
||||||
]
|
]
|
||||||
|
|
||||||
migrateDB
|
migrateDB
|
||||||
|
|
|
@ -174,6 +174,8 @@ module Vervis.Migration.Model
|
||||||
, RemoteObject215Generic (..)
|
, RemoteObject215Generic (..)
|
||||||
, RemoteDiscussion215
|
, RemoteDiscussion215
|
||||||
, RemoteDiscussion215Generic (..)
|
, RemoteDiscussion215Generic (..)
|
||||||
|
, model_2020_02_09
|
||||||
|
, TicketUnderProject223Generic (..)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
@ -335,3 +337,9 @@ makeEntitiesMigration "205"
|
||||||
|
|
||||||
makeEntitiesMigration "215"
|
makeEntitiesMigration "215"
|
||||||
$(modelFile "migrations/2020_02_09_rd_point_to_ro.model")
|
$(modelFile "migrations/2020_02_09_rd_point_to_ro.model")
|
||||||
|
|
||||||
|
model_2020_02_09 :: [Entity SqlBackend]
|
||||||
|
model_2020_02_09 = $(schema "2020_02_09_tup")
|
||||||
|
|
||||||
|
makeEntitiesMigration "223"
|
||||||
|
$(modelFile "migrations/2020_02_09_tup_mig.model")
|
||||||
|
|
Loading…
Reference in a new issue