add PostgreSQL backend and portable backup system.#3999
Open
JustRin wants to merge 2 commits intoMHSanaei:mainfrom
Open
add PostgreSQL backend and portable backup system.#3999JustRin wants to merge 2 commits intoMHSanaei:mainfrom
JustRin wants to merge 2 commits intoMHSanaei:mainfrom
Conversation
- Add SQLite/PostgreSQL switching via panel UI and env variables - Introduce portable .xui-backup format for cross-backend backups - Add connection pooling and PrepareStmt cache for PostgreSQL - Fix raw SQL double-quote bug breaking queries on PostgreSQL - Fix GORM record-not-found log spam on every Xray config poll - Add database section to Settings with full EN/RU i18n
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the pull request?
Adds PostgreSQL as a second database backend alongside SQLite. Both backends are interchangeable at runtime via the panel UI or environment variables, with automatic data migration and zero data loss. Introduces a portable, driver-agnostic backup format (.xui-backup) that works with both engines. Also fixes several bugs uncovered during PostgreSQL testing.
Which part of the application is affected by the change?
Type of Changes
Changes
Details
New database layer (database/backup.go, database/manager.go, config/database.go):
PostgreSQL connection (database/db.go):
Settings UI (web/html/settings/panel/general.html):
Bug fixes:
inbound.go — raw SQL "listen = """ → parameterized "listen = ?" (PostgreSQL treats "" as identifier, not string literal)
setting.go — First() → Limit(1).Find() to suppress GORM error-level log on every Xray config poll
setting.go (controller) — testDatabaseSetting now returns correct success/failure message separately
i18n: [pages.settings.database] section — 40 keys in en_US and ru_RU
Environment variable override (Docker / IaC)
When any XUI_DB_* variable is set, the Database section in the UI becomes read-only.
Screenshots