mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-09 23:02:59 +03:00
[PR #79] [MERGED] feat: add support for Postgres database provider #956
Reference in New Issue
Block a user
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/pocket-id/pocket-id/pull/79
Author: @stonith404
Created: 12/12/2024
Status: ✅ Merged
Merged: 12/12/2024
Merged by: @stonith404
Base:
main← Head:feat/postgres-support📝 Commits (6)
7132bf1add Postgres supporta5f49d6add db provider docs157e941test both sqlite and postgres in e2e tests62e5266add step to wait for database in e2e testsb707fb8fix caddy ambiguous config file format errordcbd2adremove postgres database name requirement📊 Changes
38 files changed (+432 additions, -80 deletions)
View changed files
➖
.env.test(+0 -2)📝
.github/workflows/e2e-tests.yml(+108 -7)📝
README.md(+15 -13)📝
backend/.env.example(+3 -1)📝
backend/go.mod(+7 -1)📝
backend/go.sum(+54 -2)📝
backend/internal/bootstrap/db_bootstrap.go(+33 -10)📝
backend/internal/common/env_config.go(+41 -18)📝
backend/internal/controller/webauthn_controller.go(+1 -3)📝
backend/internal/model/types/date_time.go(+6 -1)📝
backend/internal/model/user.go(+1 -1)📝
backend/internal/model/webauthn.go(+3 -2)📝
backend/internal/service/test_service.go(+23 -7)📝
backend/internal/service/webauthn_service.go(+7 -10)➕
backend/migrations/postgres/20241211111554_init.up.sql(+126 -0)📝
backend/migrations/sqlite/20240731203656_init.up.sql(+0 -0)📝
backend/migrations/sqlite/20240813211251_passkey_backup_flags..up.sql(+0 -0)📝
backend/migrations/sqlite/20240813211251_passkey_backup_flags.down.sql(+0 -0)📝
backend/migrations/sqlite/20240817191051_rename_config_table.down.sql(+0 -0)📝
backend/migrations/sqlite/20240817191051_rename_config_table.up.sql(+0 -0)...and 18 more files
📄 Description
With this PR it is now possible to use Postgres instead of Sqlite as the database provider.
The following environment variables were added that allows the admin to configure the database provider:
DB_PROVIDERsqlitesqliteandpostgresare supported.SQLITE_DB_PATHdata/pocket-id.dbDB_PROVIDERtosqlite.POSTGRES_CONNECTION_STRING-DB_PROVIDERtopostgres. A connection string can look like this:postgresql://user:password@host:5432/pocket-id.This PR can be tested with the
stonith404/pocket-id:postgres-developmentDocker image.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.