From fb9e2dd4dd58a1ae453ec55b8d37dac05fa0024c Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sat, 8 Feb 2020 09:35:35 +0000 Subject: [PATCH] DB: In TAL and TAR, rename 'offer' to 'open' That's because with the Create flow added, the activity that reports a ticket can be either Create or Offer, maybe later Announce too. The old TAL unique name mentioned in the migration has what may look like a typo, "Locale" instead of "Local". That's because I made a typo in migration 115, and now needed to specify the typoed name I used then. I verified in dev DB and on dev.angeley.es DB that the typo is reflected in the PostgreSQL database side and fixed by the new migrations. --- config/models | 12 ++++++------ src/Vervis/API.hs | 2 +- src/Vervis/Federation/Ticket.hs | 2 +- src/Vervis/Handler/Client.hs | 2 +- src/Vervis/Migration.hs | 14 ++++++++++++++ 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/config/models b/config/models index dca8432..553ea5c 100644 --- a/config/models +++ b/config/models @@ -375,18 +375,18 @@ TicketProjectLocal TicketAuthorLocal ticket LocalTicketId author PersonId - offer OutboxItemId + open OutboxItemId - UniqueTicketAuthorLocal ticket - UniqueTicketAuthorLocalOffer offer + UniqueTicketAuthorLocal ticket + UniqueTicketAuthorLocalOpen open TicketAuthorRemote ticket TicketProjectLocalId author RemoteActorId - offer RemoteActivityId + open RemoteActivityId - UniqueTicketAuthorRemote ticket - UniqueTicketAuthorRemoteOffer offer + UniqueTicketAuthorRemote ticket + UniqueTicketAuthorRemoteOpen open TicketDependency parent TicketId diff --git a/src/Vervis/API.hs b/src/Vervis/API.hs index cc0c529..625c767 100644 --- a/src/Vervis/API.hs +++ b/src/Vervis/API.hs @@ -877,7 +877,7 @@ offerTicketC shrUser summary audience offer@(Offer ticket uTarget) = runExceptT insert_ TicketAuthorLocal { ticketAuthorLocalTicket = ltid , ticketAuthorLocalAuthor = pidAuthor - , ticketAuthorLocalOffer = obiid + , ticketAuthorLocalOpen = obiid } --insertMany_ $ map (TicketDependency tid) tidsDeps -- insert_ $ Follow pidAuthor fsid False True diff --git a/src/Vervis/Federation/Ticket.hs b/src/Vervis/Federation/Ticket.hs index 3ffb384..471f098 100644 --- a/src/Vervis/Federation/Ticket.hs +++ b/src/Vervis/Federation/Ticket.hs @@ -286,7 +286,7 @@ projectOfferTicketF insert_ TicketAuthorRemote { ticketAuthorRemoteTicket = tplid , ticketAuthorRemoteAuthor = raidAuthor - , ticketAuthorRemoteOffer = ractid + , ticketAuthorRemoteOpen = ractid } docAccept <- insertAccept ra luOffer ltid obiidAccept -- insertMany_ $ map (TicketDependency tid) deps diff --git a/src/Vervis/Handler/Client.hs b/src/Vervis/Handler/Client.hs index 0b4c04c..71eacc9 100644 --- a/src/Vervis/Handler/Client.hs +++ b/src/Vervis/Handler/Client.hs @@ -694,7 +694,7 @@ postTicketsR shr prj = do ExceptT $ offerTicket shrAuthor (TextHtml title) (TextPandocMarkdown desc) shr prj obiid <- ExceptT $ offerTicketC shrAuthor summary audience offer ExceptT $ runDB $ do - mtal <- getValBy $ UniqueTicketAuthorLocalOffer obiid + mtal <- getValBy $ UniqueTicketAuthorLocalOpen obiid return $ case mtal of Nothing -> diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index 7f913c5..6fbf81b 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -1407,6 +1407,20 @@ changes hLocal ctx = "UniqueTicketAuthorRemote" -- 210 , renameField "TicketAuthorRemote" "ticketNew" "ticket" + -- 211 + , renameField "TicketAuthorLocal" "offer" "open" + -- 212 + , renameUnique + "TicketAuthorLocal" + "UniqueTicketAuthorLocaleOffer" + "UniqueTicketAuthorLocalOpen" + -- 213 + , renameField "TicketAuthorRemote" "offer" "open" + -- 214 + , renameUnique + "TicketAuthorRemote" + "UniqueTicketAuthorRemoteOffer" + "UniqueTicketAuthorRemoteOpen" ] migrateDB