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 PermitTopicEnableLocal
PermitTopicEnableRemote PermitTopicEnableRemote
RemoteActivity RemoteActivity
Outbox
OutboxItem OutboxItem
outbox OutboxId outbox OutboxId
activity PersistJSONObject activity PersistJSONObject
@ -46,3 +43,39 @@ PermitTopicExtendRemote
grant RemoteActivityId grant RemoteActivityId
UniquePermitTopicExtendRemoteGrant grant 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 -- 594
, addFieldRefRequired'' , addFieldRefRequired''
"PermitTopicExtendLocal" "PermitTopicExtendLocal"
(do permitID <- do (do outboxID <- insert Outbox593
personID <- do personID <- do
mp <- selectFirst [] [Asc Person593Id] inboxID <- insert Inbox593
entityKey <$> maybe (error "No people") return mp fsID <- insert FollowerSet593
insert $ Permit593 personID RoleVisit 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 itemID <- do
outboxID <- insert Outbox593
let doc = persistJSONObjectFromDoc $ Doc hLocal emptyActivity let doc = persistJSONObjectFromDoc $ Doc hLocal emptyActivity
insert $ OutboxItem593 outboxID doc defaultTime insert $ OutboxItem593 outboxID doc defaultTime
gestureID <- insert $ PermitPersonGesture593 permitID itemID gestureID <- insert $ PermitPersonGesture593 permitID itemID
@ -3280,14 +3281,22 @@ changes hLocal ctx =
PermitPersonSendDelegator593 gestureID itemID <- getJust tempSendID PermitPersonSendDelegator593 gestureID itemID <- getJust tempSendID
PermitPersonGesture593 permitID _ <- getJust gestureID PermitPersonGesture593 permitID _ <- getJust gestureID
Permit593 personID _ <- getJust permitID
OutboxItem593 outboxID _ _ <- getJust itemID OutboxItem593 outboxID _ _ <- getJust itemID
actorID <- person593Actor <$> getJust personID
Actor593 _ _ _ inboxID _ fsID _ <- getJust actorID
delete tempExtendID delete tempExtendID
delete tempSendID delete tempSendID
delete gestureID delete gestureID
delete itemID delete itemID
delete outboxID
delete permitID delete permitID
delete personID
delete actorID
delete outboxID
delete inboxID
delete fsID
) )
"permitNew" "permitNew"
"PermitTopicExtend" "PermitTopicExtend"
@ -3295,14 +3304,14 @@ changes hLocal ctx =
, addFieldRefRequired'' , addFieldRefRequired''
"PermitTopicExtendRemote" "PermitTopicExtendRemote"
(do let doc = persistJSONObjectFromDoc $ Doc hLocal emptyActivity (do let doc = persistJSONObjectFromDoc $ Doc hLocal emptyActivity
permitID <- do outboxID <- insert Outbox593
personID <- do personID <- do
mp <- selectFirst [] [Asc Person593Id] inboxID <- insert Inbox593
entityKey <$> maybe (error "No people") return mp fsID <- insert FollowerSet593
insert $ Permit593 personID RoleVisit actorID <- insert $ Actor593 "" "" defaultTime inboxID outboxID fsID Nothing
itemID <- do insert $ Person593 "$$temp$$" "$$temp$$" "" (unsafeEmailAddress "x" "y") False "" defaultTime "" defaultTime actorID
outboxID <- insert Outbox593 permitID <- insert $ Permit593 personID RoleVisit
insert $ OutboxItem593 outboxID doc defaultTime itemID <- insert $ OutboxItem593 outboxID doc defaultTime
gestureID <- insert $ PermitPersonGesture593 permitID itemID gestureID <- insert $ PermitPersonGesture593 permitID itemID
sendID <- insert $ PermitPersonSendDelegator593 gestureID itemID sendID <- insert $ PermitPersonSendDelegator593 gestureID itemID
insertEntity $ PermitTopicExtend593 sendID insertEntity $ PermitTopicExtend593 sendID
@ -3315,14 +3324,22 @@ changes hLocal ctx =
PermitPersonSendDelegator593 gestureID itemID <- getJust tempSendID PermitPersonSendDelegator593 gestureID itemID <- getJust tempSendID
PermitPersonGesture593 permitID _ <- getJust gestureID PermitPersonGesture593 permitID _ <- getJust gestureID
Permit593 personID _ <- getJust permitID
OutboxItem593 outboxID _ _ <- getJust itemID OutboxItem593 outboxID _ _ <- getJust itemID
actorID <- person593Actor <$> getJust personID
Actor593 _ _ _ inboxID _ fsID _ <- getJust actorID
delete tempExtendID delete tempExtendID
delete tempSendID delete tempSendID
delete gestureID delete gestureID
delete itemID delete itemID
delete outboxID
delete permitID delete permitID
delete personID
delete actorID
delete outboxID
delete inboxID
delete fsID
) )
"permitNew" "permitNew"
"PermitTopicExtend" "PermitTopicExtend"