Fix migrations 594 & 595 that were requiring a Person in DB

This commit is contained in:
Pere Lev 2024-07-29 12:25:50 +03:00
parent e0935ee6db
commit 3ddae07d26
No known key found for this signature in database
GPG key ID: 5252C5C863E5E57D
2 changed files with 69 additions and 19 deletions

View file

@ -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

View file

@ -3259,13 +3259,14 @@ changes hLocal ctx =
-- 594
, addFieldRefRequired''
"PermitTopicExtendLocal"
(do permitID <- do
(do outboxID <- insert Outbox593
personID <- do
mp <- selectFirst [] [Asc Person593Id]
entityKey <$> maybe (error "No people") return mp
insert $ Permit593 personID RoleVisit
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
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"