diff --git a/migrations/554_2023-11-21_further_local_deleg.model b/migrations/554_2023-11-21_further_local_deleg.model index b4710e1..283307a 100644 --- a/migrations/554_2023-11-21_further_local_deleg.model +++ b/migrations/554_2023-11-21_further_local_deleg.model @@ -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 diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index f02170f..a8994db 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -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"