[PR #500] [MERGED] fix: saving bookmarks inconsistencies #621

Closed
opened 2026-02-25 23:34:56 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-shiori/shiori/pull/500
Author: @fmartingr
Created: 10/11/2022
Status: Merged
Merged: 10/11/2022
Merged by: @fmartingr

Base: masterHead: fix/database-save


📝 Commits (10+)

  • b612236 chore: updated go-migrate dependencies
  • 5624858 fix: specify if we're saving bookmarks expecting a creation
  • c4f44cc fix(api): using incorrect bookmark for content downlaod
  • a5c11ee test(db): added test pipeline for databases
  • 6ce379c dev: added basic docker-compose for development
  • 3f7e384 chore: uncommented tests
  • 135dc13 ci(test): added mysql service
  • 165fc27 typo
  • 6206cf9 test(mysql): select database after reset
  • 5341d2d fix(mysql): ignore empty row errors when parsing tags

📊 Changes

19 files changed (+384 additions, -82 deletions)

View changed files

📝 .github/workflows/_test.yml (+16 -0)
Dockerfile.compose (+6 -0)
docker-compose.yaml (+46 -0)
📝 go.mod (+1 -1)
📝 go.sum (+2 -2)
📝 internal/cmd/add.go (+1 -1)
📝 internal/cmd/import.go (+1 -1)
📝 internal/cmd/pocket.go (+1 -1)
📝 internal/cmd/update.go (+1 -1)
📝 internal/database/database.go (+1 -1)
internal/database/database_test.go (+103 -0)
📝 internal/database/mysql.go (+37 -22)
internal/database/mysql_test.go (+60 -0)
📝 internal/database/pg.go (+18 -7)
📝 internal/database/pg_test.go (+15 -23)
📝 internal/database/sqlite.go (+28 -13)
internal/database/sqlite_test.go (+36 -0)
📝 internal/webserver/handler-api-ext.go (+2 -2)
📝 internal/webserver/handler-api.go (+9 -7)

📄 Description

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 github.com/go-shiori/shiori@222fc14fe2 and github.com/go-shiori/shiori@dc73cd825b 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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-shiori/shiori/pull/500 **Author:** [@fmartingr](https://github.com/fmartingr) **Created:** 10/11/2022 **Status:** ✅ Merged **Merged:** 10/11/2022 **Merged by:** [@fmartingr](https://github.com/fmartingr) **Base:** `master` ← **Head:** `fix/database-save` --- ### 📝 Commits (10+) - [`b612236`](https://github.com/go-shiori/shiori/commit/b612236f20773da6c9c86069adfd8f9548b6e6f9) chore: updated go-migrate dependencies - [`5624858`](https://github.com/go-shiori/shiori/commit/56248581687ea4d5d3b23475a5735bc801e07a10) fix: specify if we're saving bookmarks expecting a creation - [`c4f44cc`](https://github.com/go-shiori/shiori/commit/c4f44cc2303ff7bdcc2abfd6ce691946ea16ba3c) fix(api): using incorrect bookmark for content downlaod - [`a5c11ee`](https://github.com/go-shiori/shiori/commit/a5c11ee8e6460059b43a06e0bbe977ccc38cf965) test(db): added test pipeline for databases - [`6ce379c`](https://github.com/go-shiori/shiori/commit/6ce379c0b120a9e0a39c5fe75067d21cb1f3077c) dev: added basic docker-compose for development - [`3f7e384`](https://github.com/go-shiori/shiori/commit/3f7e384d6d04e5b7230547d962f8b501e851501c) chore: uncommented tests - [`135dc13`](https://github.com/go-shiori/shiori/commit/135dc13bcd8b1c8576ea8e0f43f6117cb2117d8f) ci(test): added mysql service - [`165fc27`](https://github.com/go-shiori/shiori/commit/165fc27248be80add33e51cfc44d792eb2c836d1) typo - [`6206cf9`](https://github.com/go-shiori/shiori/commit/6206cf97595170efc98513db8adc986238273b15) test(mysql): select database after reset - [`5341d2d`](https://github.com/go-shiori/shiori/commit/5341d2d8fd1cc8f360d9ae9a641d630839a5c473) fix(mysql): ignore empty row errors when parsing tags ### 📊 Changes **19 files changed** (+384 additions, -82 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/_test.yml` (+16 -0) ➕ `Dockerfile.compose` (+6 -0) ➕ `docker-compose.yaml` (+46 -0) 📝 `go.mod` (+1 -1) 📝 `go.sum` (+2 -2) 📝 `internal/cmd/add.go` (+1 -1) 📝 `internal/cmd/import.go` (+1 -1) 📝 `internal/cmd/pocket.go` (+1 -1) 📝 `internal/cmd/update.go` (+1 -1) 📝 `internal/database/database.go` (+1 -1) ➕ `internal/database/database_test.go` (+103 -0) 📝 `internal/database/mysql.go` (+37 -22) ➕ `internal/database/mysql_test.go` (+60 -0) 📝 `internal/database/pg.go` (+18 -7) 📝 `internal/database/pg_test.go` (+15 -23) 📝 `internal/database/sqlite.go` (+28 -13) ➕ `internal/database/sqlite_test.go` (+36 -0) 📝 `internal/webserver/handler-api-ext.go` (+2 -2) 📝 `internal/webserver/handler-api.go` (+9 -7) </details> ### 📄 Description 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 https://github.com/go-shiori/shiori/commit/222fc14fe29f9988db9aca2972c2f3a29c3914b0 and https://github.com/go-shiori/shiori/commit/dc73cd825b9d8b997364062b625bb4b3f15bc1c8 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-25 23:34:56 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shiori#621
No description provided.