From 6b0783a10b66155504ea94efba836871f3df9dcf Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Mon, 26 Sep 2022 13:12:44 +0000 Subject: [PATCH] DB: Migration: Fix error in mig 447, accidentally creation CollabTopicLocal Repo/Loom/Deck created one in their migrations, but CollabTopicAccept isn't itself a topic, it's just a helper, so it needs to *find* the relevant CollabTopicLocal rather than create a new one. --- src/Vervis/Migration.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index b78bc60..9b970ec 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -2539,8 +2539,11 @@ changes hLocal ctx = (Just $ \ (Entity topicTemp (CollabTopicLocal447 collabTemp)) -> do collabs <- selectList [] [] for_ collabs $ \ (Entity topicID topic) -> do + maybeLocal <- getKeyBy $ UniqueCollabTopicLocal447 $ collabTopicLocalAccept447Collab topic localID <- - insert $ CollabTopicLocal447 $ collabTopicLocalAccept447Collab topic + case maybeLocal of + Nothing -> error "No CollabTopicLocal for this Collab" + Just l -> return l update topicID [CollabTopicLocalAccept447CollabNew =. localID] delete topicTemp