Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lexicon: declaration, assertion/confirmation, follow app migration #664

Merged
merged 5 commits into from
Mar 16, 2023

Conversation

devinivy
Copy link
Collaborator

Two app migrations contained here:

  1. Remove declaration, assertion, and confirmation records.
  2. Update follow records so that their subject is a did rather than an actor ref. Invalid follow records are deleted.

In both we use the repo service, which takes care of updating repositories plus the generic record index. If any app-view related changes are needed, those are handled at the end of the migrations— that would include updates to duplicate_record and follow tables. A no-op messageDispatcher is used rather than a real one in order to avoid app-view indexing logic from kicking in.

validate: false,
})
} catch {
const del = prepareDelete({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious, how many hit this in trial runs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were 7, I think. I looked at them all and they were indeed malformed in some way (either a handle rather than a did, or empty did).

Copy link
Collaborator

@dholms dholms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These both looks really great 🙌

Would you be up for adding some quick sanity checks at the end, that throw if they fail? like "count of follows = count before migration - count deleted" & "no declaration/assertion/confirmation left in records?

// Should be 4-5k records
const recordsToDelete = await tx.db
.selectFrom('record')
.innerJoin('repo_root', 'repo_root.did', 'record.did') // Ignore any records not in a repo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you encounter any of these in your tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't check actually, but I could do a run without this and find out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay this was overly paranoid, it just doesn't happen on any environment 😆 Will remove.

}),
)

await repoTx.processWrites(did, updates, now)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah probably wanna ensure updates.length > 0

@devinivy
Copy link
Collaborator Author

@dholms should be good for another look!

Copy link
Collaborator

@dholms dholms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great 👍

@devinivy devinivy mentioned this pull request Mar 16, 2023
@devinivy devinivy merged commit d63eaba into lex-refactor Mar 16, 2023
@devinivy devinivy deleted the lex/declaration-assertion-app-migration branch March 16, 2023 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants