diff --git a/migrations/593_2024-04-18_permit_extend.model b/migrations/593_2024-04-18_permit_extend.model index 31a6884..ccb9777 100644 --- a/migrations/593_2024-04-18_permit_extend.model +++ b/migrations/593_2024-04-18_permit_extend.model @@ -1,10 +1,7 @@ -Person PermitTopicEnableLocal PermitTopicEnableRemote RemoteActivity -Outbox - OutboxItem outbox OutboxId activity PersistJSONObject @@ -46,3 +43,39 @@ PermitTopicExtendRemote grant RemoteActivityId UniquePermitTopicExtendRemoteGrant grant + +Person + username Text + login Text + passphraseHash ByteString + email EmailAddress + verified Bool + verifiedKey Text + verifiedKeyCreated UTCTime + resetPassKey Text + resetPassKeyCreated UTCTime + actor ActorId + + UniquePersonUsername username + 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 + +Outbox + +FollowerSet diff --git a/src/Vervis/Migration.hs b/src/Vervis/Migration.hs index ed4c4c7..befebfb 100644 --- a/src/Vervis/Migration.hs +++ b/src/Vervis/Migration.hs @@ -3259,13 +3259,14 @@ changes hLocal ctx = -- 594 , addFieldRefRequired'' "PermitTopicExtendLocal" - (do permitID <- do - personID <- do - mp <- selectFirst [] [Asc Person593Id] - entityKey <$> maybe (error "No people") return mp - insert $ Permit593 personID RoleVisit + (do outboxID <- insert Outbox593 + personID <- do + inboxID <- insert Inbox593 + fsID <- insert FollowerSet593 + actorID <- insert $ Actor593 "" "" defaultTime inboxID outboxID fsID Nothing + insert $ Person593 "$$temp$$" "$$temp$$" "" (unsafeEmailAddress "x" "y") False "" defaultTime "" defaultTime actorID + permitID <- insert $ Permit593 personID RoleVisit itemID <- do - outboxID <- insert Outbox593 let doc = persistJSONObjectFromDoc $ Doc hLocal emptyActivity insert $ OutboxItem593 outboxID doc defaultTime gestureID <- insert $ PermitPersonGesture593 permitID itemID @@ -3280,14 +3281,22 @@ changes hLocal ctx = PermitPersonSendDelegator593 gestureID itemID <- getJust tempSendID PermitPersonGesture593 permitID _ <- getJust gestureID + Permit593 personID _ <- getJust permitID OutboxItem593 outboxID _ _ <- getJust itemID + actorID <- person593Actor <$> getJust personID + Actor593 _ _ _ inboxID _ fsID _ <- getJust actorID delete tempExtendID delete tempSendID delete gestureID delete itemID - delete outboxID delete permitID + + delete personID + delete actorID + delete outboxID + delete inboxID + delete fsID ) "permitNew" "PermitTopicExtend" @@ -3295,14 +3304,14 @@ changes hLocal ctx = , addFieldRefRequired'' "PermitTopicExtendRemote" (do let doc = persistJSONObjectFromDoc $ Doc hLocal emptyActivity - permitID <- do - personID <- do - mp <- selectFirst [] [Asc Person593Id] - entityKey <$> maybe (error "No people") return mp - insert $ Permit593 personID RoleVisit - itemID <- do - outboxID <- insert Outbox593 - insert $ OutboxItem593 outboxID doc defaultTime + outboxID <- insert Outbox593 + personID <- do + inboxID <- insert Inbox593 + fsID <- insert FollowerSet593 + actorID <- insert $ Actor593 "" "" defaultTime inboxID outboxID fsID Nothing + insert $ Person593 "$$temp$$" "$$temp$$" "" (unsafeEmailAddress "x" "y") False "" defaultTime "" defaultTime actorID + permitID <- insert $ Permit593 personID RoleVisit + itemID <- insert $ OutboxItem593 outboxID doc defaultTime gestureID <- insert $ PermitPersonGesture593 permitID itemID sendID <- insert $ PermitPersonSendDelegator593 gestureID itemID insertEntity $ PermitTopicExtend593 sendID @@ -3315,14 +3324,22 @@ changes hLocal ctx = PermitPersonSendDelegator593 gestureID itemID <- getJust tempSendID PermitPersonGesture593 permitID _ <- getJust gestureID + Permit593 personID _ <- getJust permitID OutboxItem593 outboxID _ _ <- getJust itemID + actorID <- person593Actor <$> getJust personID + Actor593 _ _ _ inboxID _ fsID _ <- getJust actorID delete tempExtendID delete tempSendID delete gestureID delete itemID - delete outboxID delete permitID + + delete personID + delete actorID + delete outboxID + delete inboxID + delete fsID ) "permitNew" "PermitTopicExtend"