mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[PR #1611] [CLOSED] PostgreSQL support: web push subscription store (part 1/3) #1661
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#1661
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/binwiederhier/ntfy/pull/1611
Author: @binwiederhier
Created: 2/16/2026
Status: ❌ Closed
Base:
main← Head:postgres-webpush📝 Commits (9)
e432bf2Rename PostgreSQL table prefix from wp_ to webpush_5331437Unify webpush store tests across SQLite and PostgreSQL backendsa8dcecdRefactor webpush store tests and add coveragebdd2019Manual refinements869b972Manual review4e5f95bRefactor webpush store to eliminate code duplication82e15d8Manual changesceda5ecMove things in user packageb567b4eMerge branch 'main' into postgres-webpush📊 Changes
23 files changed (+1336 additions, -931 deletions)
View changed files
📝
cmd/serve.go(+5 -2)📝
docs/config.md(+23 -4)📝
docs/releases.md(+7 -0)📝
go.mod(+4 -0)📝
go.sum(+9 -0)📝
server/config.go(+2 -0)📝
server/server.go(+9 -4)📝
server/server.yml(+6 -0)📝
server/server_webpush.go(+3 -2)📝
server/server_webpush_test.go(+9 -9)📝
server/types.go(+0 -16)➖
server/webpush_store.go(+0 -285)➖
server/webpush_store_test.go(+0 -199)📝
user/manager.go(+7 -408)➕
user/migrations.go(+342 -0)📝
user/util.go(+70 -2)➕
webpush/store.go(+188 -0)➕
webpush/store_postgres.go(+126 -0)➕
webpush/store_postgres_test.go(+91 -0)➕
webpush/store_sqlite.go(+138 -0)...and 3 more files
📄 Description
Adds PostgreSQL as an alternative database backend for the web push subscription store, towards #1114.
Parts
Summary
webpush/package -- moved the web push store out ofserver/into its ownwebpush/package with aStoreinterface and separate implementations (sqlite.go,postgres.go)PostgresStorewithwebpush_-prefixed tables,$Nplaceholders,BIGINTtypes,ON CONFLICTupserts, and FK cascadesdatabase-urlconfig option -- new global--database-urlflag (env:NTFY_DATABASE_URL) for PostgreSQL connection strings; when set, the web push store uses PostgreSQL instead of SQLitestore_test.goruns against both SQLite and PostgreSQL backends; PostgreSQL tests create an isolated schema per test and skip whenNTFY_TEST_DATABASE_URLis not setFiles changed
webpush/store.go,webpush/sqlite.go,webpush/postgres.gowebpush/store_test.go,webpush/sqlite_test.go,webpush/postgres_test.goserver/config.go,cmd/serve.go,server/server.ymlserver/server.go,server/server_webpush.go,server/types.goserver/server_webpush_test.godocs/config.md,docs/releases.mdserver/webpush_store.go,server/webpush_store_test.goNext steps
This is the first store to get PostgreSQL support. The same pattern (interface + factory in
server.go+database-urlconfig) is designed to extend to the message cache and user manager.Refs #1114
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.