[PR #484] [MERGED] fix(psql): save bookmarks not using passed bookmark id for the insert #613

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

📋 Pull Request Information

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

Base: masterHead: issue-215


📝 Commits (10+)

  • 7065eae fix(psql): get last inserted id from insert query
  • e869e4d test(psql): added save bookmarks simple test
  • 83880e6 ci: added postgresql service
  • 9ee1ce4 fix(typo): QueryRow -> QueryRowContext
  • f80a572 ci: explicit postgresql port
  • 7752611 ci(test): 1.19 only
  • 77bfeb9 ci: bind psql to localhost
  • 1e92a27 test(pg): migrate before test
  • bef158a test(pg): migrate database before test
  • 4d21498 fix(pg): check no rows error on get query

📊 Changes

5 files changed (+79 additions, -12 deletions)

View changed files

📝 .github/workflows/_test.yml (+15 -0)
📝 go.mod (+4 -0)
📝 go.sum (+3 -0)
📝 internal/database/pg.go (+9 -12)
internal/database/pg_test.go (+48 -0)

📄 Description

PGDatabase.SaveBookmarks was not using the (mandatory) bookmark.ID field on inserts since it was only assuming the returning ID was the same that CreateNewID provided in the handlers.

I've removed the checks and modified the query to return the inserted ID which is later used in relations with tags.

Also added a simple test case, since we need to start doing those!

Fixes #215 #385


🔄 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/484 **Author:** [@fmartingr](https://github.com/fmartingr) **Created:** 10/4/2022 **Status:** ✅ Merged **Merged:** 10/9/2022 **Merged by:** [@fmartingr](https://github.com/fmartingr) **Base:** `master` ← **Head:** `issue-215` --- ### 📝 Commits (10+) - [`7065eae`](https://github.com/go-shiori/shiori/commit/7065eae4fc1bcc9c91f99e4cc7824c6aff61b929) fix(psql): get last inserted id from insert query - [`e869e4d`](https://github.com/go-shiori/shiori/commit/e869e4d6f06bc30a10d844ac490983764fd25c76) test(psql): added save bookmarks simple test - [`83880e6`](https://github.com/go-shiori/shiori/commit/83880e6e2126159afdc1937f5f9c1d7d4dfa2e13) ci: added postgresql service - [`9ee1ce4`](https://github.com/go-shiori/shiori/commit/9ee1ce46ce7f12f4c5ad98d722e1805ae9556bd0) fix(typo): QueryRow -> QueryRowContext - [`f80a572`](https://github.com/go-shiori/shiori/commit/f80a57266efe909a0cd0429bf10d302312368194) ci: explicit postgresql port - [`7752611`](https://github.com/go-shiori/shiori/commit/7752611ff667cf38a38664fb032829564df93a3b) ci(test): 1.19 only - [`77bfeb9`](https://github.com/go-shiori/shiori/commit/77bfeb9988937aac26b993c0d59ec57cd062a419) ci: bind psql to localhost - [`1e92a27`](https://github.com/go-shiori/shiori/commit/1e92a2727c5ae6acc94edff4ea317d34b9566ce9) test(pg): migrate before test - [`bef158a`](https://github.com/go-shiori/shiori/commit/bef158a994cde82a3267484460aa18799a8ab488) test(pg): migrate database before test - [`4d21498`](https://github.com/go-shiori/shiori/commit/4d214985eee552cf04ba7066b57af04d0ac34dfa) fix(pg): check no rows error on get query ### 📊 Changes **5 files changed** (+79 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/_test.yml` (+15 -0) 📝 `go.mod` (+4 -0) 📝 `go.sum` (+3 -0) 📝 `internal/database/pg.go` (+9 -12) ➕ `internal/database/pg_test.go` (+48 -0) </details> ### 📄 Description `PGDatabase.SaveBookmarks` was not using the (mandatory) `bookmark.ID` field on inserts since it was only assuming the returning ID was the same that `CreateNewID` provided in the handlers. I've removed the checks and modified the query to return the inserted ID which is later used in relations with tags. Also added a simple test case, since we need to start doing those! Fixes #215 #385 --- <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:54 +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#613
No description provided.