Fix "no people" bug in migration 554

This commit is contained in:
Pere Lev 2024-08-06 12:54:21 +03:00
parent e196ee6f34
commit 18bcfb88f2
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D
2 changed files with 34 additions and 5 deletions

View file

@ -1,5 +1,4 @@
ComponentEnable
Actor
Outbox
@ -43,7 +42,7 @@ ComponentFurtherLocal
UniqueComponentFurtherLocalGrant grant
Person
username Username
username Text
login Text
passphraseHash ByteString
email EmailAddress
@ -59,3 +58,20 @@ Person
UniquePersonLogin login
UniquePersonEmail email
UniquePersonActor actor
Actor
name Text
desc Text
createdAt UTCTime
inbox InboxId
outbox OutboxId
followers FollowerSetId
justCreatedBy ActorId Maybe
UniqueActorInbox inbox
UniqueActorOutbox outbox
UniqueActorFollowers followers
Inbox
FollowerSet

View file

@ -3081,9 +3081,13 @@ changes hLocal ctx =
let doc = persistJSONObjectFromDoc $ Doc hLocal emptyActivity
itemID <- insert $ OutboxItem554 outboxID doc defaultTime
enableID <- insert $ CollabEnable554 collabID itemID
personID <- do
mp <- selectFirst [] [Asc Person554Id]
entityKey <$> maybe (error "No people") return mp
inboxID <- insert Inbox554
fsID <- insert FollowerSet554
actorID <- insert $ Actor554 "" "" defaultTime inboxID outboxID fsID Nothing
insert $ Person554 "$$temp$$" "$$temp$$" "" (unsafeEmailAddress "x" "y") False "" defaultTime "" defaultTime actorID
recipID <- insert $ CollabRecipLocal554 collabID personID
insertEntity $ CollabDelegLocal554 enableID recipID itemID
)
@ -3097,13 +3101,22 @@ changes hLocal ctx =
delete cdlidTemp
let CollabDelegLocal554 enableID recipID itemID = cdlTemp
CollabRecipLocal554 _ personID <- getJust recipID
actorID <- person554Actor <$> getJust personID
Actor554 _ _ _ inboxID _ fsID _ <- getJust actorID
delete recipID
collabID <- collabEnable554Collab <$> getJust enableID
delete enableID
outboxID <- outboxItem554Outbox <$> getJust itemID
delete itemID
delete outboxID
delete collabID
delete personID
delete actorID
delete outboxID
delete inboxID
delete fsID
)
"collabNew"
"CollabDelegLocal"