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 ComponentEnable
Actor
Outbox Outbox
@ -43,7 +42,7 @@ ComponentFurtherLocal
UniqueComponentFurtherLocalGrant grant UniqueComponentFurtherLocalGrant grant
Person Person
username Username username Text
login Text login Text
passphraseHash ByteString passphraseHash ByteString
email EmailAddress email EmailAddress
@ -59,3 +58,20 @@ Person
UniquePersonLogin login UniquePersonLogin login
UniquePersonEmail email UniquePersonEmail email
UniquePersonActor actor 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 let doc = persistJSONObjectFromDoc $ Doc hLocal emptyActivity
itemID <- insert $ OutboxItem554 outboxID doc defaultTime itemID <- insert $ OutboxItem554 outboxID doc defaultTime
enableID <- insert $ CollabEnable554 collabID itemID enableID <- insert $ CollabEnable554 collabID itemID
personID <- do personID <- do
mp <- selectFirst [] [Asc Person554Id] inboxID <- insert Inbox554
entityKey <$> maybe (error "No people") return mp 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 recipID <- insert $ CollabRecipLocal554 collabID personID
insertEntity $ CollabDelegLocal554 enableID recipID itemID insertEntity $ CollabDelegLocal554 enableID recipID itemID
) )
@ -3097,13 +3101,22 @@ changes hLocal ctx =
delete cdlidTemp delete cdlidTemp
let CollabDelegLocal554 enableID recipID itemID = cdlTemp let CollabDelegLocal554 enableID recipID itemID = cdlTemp
CollabRecipLocal554 _ personID <- getJust recipID
actorID <- person554Actor <$> getJust personID
Actor554 _ _ _ inboxID _ fsID _ <- getJust actorID
delete recipID delete recipID
collabID <- collabEnable554Collab <$> getJust enableID collabID <- collabEnable554Collab <$> getJust enableID
delete enableID delete enableID
outboxID <- outboxItem554Outbox <$> getJust itemID outboxID <- outboxItem554Outbox <$> getJust itemID
delete itemID delete itemID
delete outboxID
delete collabID delete collabID
delete personID
delete actorID
delete outboxID
delete inboxID
delete fsID
) )
"collabNew" "collabNew"
"CollabDelegLocal" "CollabDelegLocal"