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

Fix pouch db migration edge cases #9820

Merged
merged 1 commit into from
Jan 10, 2024
Merged

Fix pouch db migration edge cases #9820

merged 1 commit into from
Jan 10, 2024

Conversation

riknoll
Copy link
Member

@riknoll riknoll commented Jan 9, 2024

This fixes a couple of pouch db migration bugs.

First, I was writing back to the pouchDB db to mark each entry as migrated so that we didn't accidentally re-import them. This was causing problems due to the internal structure of the pouchDB which has some uniqueness constraints that were being violated. Now I just sidestep that issue by storing the ids of the projects that have already been migrated in a separate db. This fixes the issue we were seeing with github projects in testing.

Secondly, I now check to see if the pouchDB actually exists before doing any migrating. This fixes an issue that prevented accessing old versions of the editor if you were in a browser with no pre-existing pouchDB. Figuring out if the db already exists was a little tricky; see the comment in the function for an explanation.

@riknoll riknoll requested review from abchatra and a team January 9, 2024 23:53
db.createObjectStore(GITHUB_TABLE, { keyPath: KEYPATH });
}, async () => {
await pxt.BrowserUtils.clearTranslationDbAsync();
await pxt.BrowserUtils.clearTutorialInfoDbAsync();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we clearing the TutorialInfoDb here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see. This is just to free up space if needed...

@riknoll riknoll merged commit b113368 into master Jan 10, 2024
7 checks passed
@riknoll riknoll deleted the dev/riknoll/pouch-db-set branch January 10, 2024 18:48
riknoll added a commit that referenced this pull request Jan 12, 2024
riknoll added a commit that referenced this pull request Jan 22, 2024
…#9824)

* Stop using PouchDB (#9810)

* migrate pouchDB without a dependency on pouchDB

* obliterate PouchDb

* copy extra info to current db

* fix copyToLegacyEditor

* don't delete projects from pouchdb

* Don't give a ridiculously high pouchdb version (#9819)

* fix pouch db migration edge cases (#9820)

* delete the _doc_id_rev when migrating entries (#9822)
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.

2 participants