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: saving bookmarks inconsistencies #500

Merged
merged 13 commits into from
Oct 11, 2022
Merged

fix: saving bookmarks inconsistencies #500

merged 13 commits into from
Oct 11, 2022

Conversation

fmartingr
Copy link
Member

@fmartingr fmartingr commented Oct 11, 2022

Saving bookmarks between engines had some inconsistencies regarding the insert/update mechanism used in shiori, and our latest changes fixing some postgresql issues (Introduced by 222fc14 and dc73cd8 as pointed out in #499) where causing problems in both SQLite and Mysql.

  • Refactored DB.SaveBookmarks method, now requires an insert parameter indicating that we were expecting to create a record. false will try to update a record. it would fail either case if the condition is not met.
    • Also, queries were changed and now INSERT and UPDATE are split rather than handing conflict on INSERT, since PSQL was handling the URL field, SQLite the ID field and MySQL any failing constraint.
  • Fixed a bug on the API archive download where the bookmark used to download wasn't the one populated in the database, thus not having an ID and making the archiving fail.
  • Added a basic compose file for development only.
  • Fixed some errors on the MySql engine.
  • Added support for Github actions to run the tests

@fmartingr fmartingr self-assigned this Oct 11, 2022
up until now the SaveBookmarks method was doing some "magic" to do
"upserts" on the databases, but consistency between engines was scarce
and not knowing if we were expecting saving a new bookmark or updating
an existing one was leading to errors and inconsistencies in logic all
around the place. Now we need to specify a creation boolean when
saving and a differnt query will be make (INSERT vs UPDATE).
Added functions that will share logic among the engines and will be
called on fresh databases on each test run
@fmartingr fmartingr marked this pull request as ready for review October 11, 2022 20:59
@fmartingr fmartingr merged commit 05fee53 into master Oct 11, 2022
@fmartingr fmartingr deleted the fix/database-save branch October 28, 2022 07:12
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.

1 participant