ckolderup / postmarks

a single-user bookmarking website designed to live on the Fediverse
https://postmarks.glitch.me
MIT License
464 stars 38 forks source link

Port actor data and account.json to application.db #138

Open johnholdun opened 1 year ago

johnholdun commented 1 year ago

This PR introduces a new database, application.db, which will eventually replace all the other data stores used by this application. For now, it is only replacing activitypub.db and account.json. Naturally, this PR also updates any business logic that used to reference those stores to instead fetch from the new database.

Still to do:

Closes #135.

johnholdun commented 10 months ago

Just pushed a really big commit whoa. Pulling on the thread of refactoring the database just lead to more and more unraveling. I ended up inlining all of the database statements that used to touch activitypub.db in their respective locations—the ORM-ish named functions were each only ever used once, and separating them the way they were lead to some unnecessary queries that I was able to combine into single statements in some cases. I recognize that this is maybe an unpopular pattern. I personally feel good about it but I'm happy to revise this if desired!

In addition, this is way too much change to be merged without serious testing, so I'm going to work on adding test coverage for all of this separately from this PR to ensure I'm not breaking stuff. We'll also want to really carefully QA the various states a user can be in while their data is being imported and migrated—I've only very cursorily tested this so far.

That said, I think all this code is in good shape and ready for review, so I'm going to mark the PR as open!