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

Decode DB contents #9186

Merged
merged 13 commits into from
Sep 16, 2024
Merged

Decode DB contents #9186

merged 13 commits into from
Sep 16, 2024

Conversation

timolegros
Copy link
Collaborator

@timolegros timolegros commented Sep 11, 2024

Note

This PR is not nearly as large as it seems to be. 652 lines are changes to the pnpm lockfile. Only 234 actual lines to review.

Link to Issue

Closes: #9182
Closes: #9168
Closes: #9169

Description of Changes

  • Created a decodeContent function which removes URI encoding and converts Quill Deltas to raw markdown
  • Added a script that decodes thread titles, thread bodies, comment bodies, and thread/comment version history
  • Removed encodeURIComponent for thread/comment CRUD API calls

Test Plan

  1. Create a thread and comment with the following data:
# Title

_Italics_

| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |
  1. Edit the thread/comment to add an image and to mention any user.
  2. View the different thread versions via thread version history
  3. Run the decode script for threads/comments and version histories (see deployment plan)
  4. View legacy Quill Delta-based threads like: http://localhost:8080/terra/discussion/15329. Compare this with https://commonwealth.im/terra/discussion/15329.

Deployment Plan

AFTER DEPLOYMENT:

  • Backup the database from the Heroku dashboard
  • Execute heroku run bash -a commonwealthapp
  • Then from packages/commonwealth/ run:
    • pnpm ts-exec scripts/decode-db-content.ts threads
    • pnpm ts-exec scripts/decode-db-content.ts thread-versions
    • pnpm ts-exec scripts/decode-db-content.ts comments
    • pnpm ts-exec scripts/decode-db-content.ts comment-versions

Other Considerations

@timolegros timolegros mentioned this pull request Sep 11, 2024
@timolegros timolegros marked this pull request as ready for review September 12, 2024 06:45
@timolegros timolegros added the deployment plan (PRs only) requires manual infrastructure changes on release label Sep 12, 2024
Copy link
Contributor

@masvelio masvelio left a comment

Choose a reason for hiding this comment

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

followed test plan, clicked around, didnt see any issues

@timolegros timolegros merged commit 889a63d into master Sep 16, 2024
10 checks passed
@timolegros timolegros deleted the tim/decode-db-contents-scripts branch September 16, 2024 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment plan (PRs only) requires manual infrastructure changes on release
Projects
None yet
4 participants