From 7809512117d96fcb9b9031e30b75275806c2360b Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Thu, 6 Feb 2020 04:18:19 +0000 Subject: [PATCH] DB: Add TicketProjectLocal table, pointing to Ticket but not in use yet --- config/models | 8 ++++++++ migrations/2020_02_07_tpl.model | 7 +++++++ migrations/2020_02_07_tpl_mig.model | 26 ++++++++++++++++++++++++++ src/Vervis/Migration.hs | 11 +++++++++++ src/Vervis/Migration/Model.hs | 10 ++++++++++ 5 files changed, 62 insertions(+) create mode 100644 migrations/2020_02_07_tpl.model create mode 100644 migrations/2020_02_07_tpl_mig.model diff --git a/config/models b/config/models index 0303dc8..563fbdf 100644 --- a/config/models +++ b/config/models @@ -367,6 +367,14 @@ LocalTicket UniqueLocalTicketDiscussion discuss UniqueLocalTicketFollowers followers +TicketProjectLocal + ticket TicketId + project ProjectId + accept OutboxItemId + + UniqueTicketProjectLocal ticket + UniqueTicketProjectLocalAccept accept + TicketAuthorLocal ticket LocalTicketId author PersonId diff --git a/migrations/2020_02_07_tpl.model b/migrations/2020_02_07_tpl.model new file mode 100644 index 0000000..0fcc385 --- /dev/null +++ b/migrations/2020_02_07_tpl.model @@ -0,0 +1,7 @@ +TicketProjectLocal + ticket TicketId + project ProjectId + accept OutboxItemId + + UniqueTicketProjectLocal ticket + UniqueTicketProjectLocalAccept accept diff --git a/migrations/2020_02_07_tpl_mig.model b/migrations/2020_02_07_tpl_mig.model new file mode 100644 index 0000000..911e9fe --- /dev/null +++ b/migrations/2020_02_07_tpl_mig.model @@ -0,0 +1,26 @@ +OutboxItem + +Project + +Ticket + project ProjectId + number Int Maybe + created UTCTime + title Text -- HTML + source Text -- Pandoc Markdown + description Text -- HTML + assignee Int64 Maybe + status Text + closed UTCTime + closer Int64 Maybe + accept OutboxItemId + + UniqueTicketAccept accept + +TicketProjectLocal + ticket TicketId + project ProjectId + accept OutboxItemId + + UniqueTicketProjectLocal ticket + UniqueTicketProjectLocalAccept accept diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index 1f9be59..db0b61a 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -1325,6 +1325,17 @@ changes hLocal ctx = "UniqueTicketAuthorLocal" -- 199 , renameField "TicketAuthorLocal" "ticketNew" "ticket" + -- 200 + , addEntities model_2020_02_07 + -- 201 + , unchecked $ lift $ do + ts <- selectList ([] :: [Filter Ticket201]) [] + let makeTPL (Entity tid t) = TicketProjectLocal201 + { ticketProjectLocal201Ticket = tid + , ticketProjectLocal201Project = ticket201Project t + , ticketProjectLocal201Accept = ticket201Accept t + } + insertMany_ $ map makeTPL ts ] migrateDB diff --git a/src/Vervis/Migration/Model.hs b/src/Vervis/Migration/Model.hs index 5f9d36d..81b9d14 100644 --- a/src/Vervis/Migration/Model.hs +++ b/src/Vervis/Migration/Model.hs @@ -155,6 +155,10 @@ module Vervis.Migration.Model , TicketAuthorLocal194 , TicketAuthorLocal194Generic (..) , Discussion194Generic (..) + , model_2020_02_07 + , Ticket201 + , Ticket201Generic (..) + , TicketProjectLocal201Generic (..) ) where @@ -304,3 +308,9 @@ makeEntitiesMigration "189" $(modelFile "migrations/2020_02_05_mig.model") makeEntitiesMigration "194" $(modelFile "migrations/2020_02_06_tal_point_to_lt.model") + +model_2020_02_07 :: [Entity SqlBackend] +model_2020_02_07 = $(schema "2020_02_07_tpl") + +makeEntitiesMigration "201" + $(modelFile "migrations/2020_02_07_tpl_mig.model")