[PR #4910] [MERGED] feat(x-ui.sh): add migrateDB command for SQLite .db <-> .dump #5748

Closed
opened 2026-11-02 04:03:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/4910
Author: @MHSanaei
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/5/2026
Merged by: @MHSanaei

Base: main ← Head: feat/x-ui-sh-migratedb


📝 Commits (3)

  • 6ca2a3f feat(x-ui.sh): add migrateDB command and menu for SQLite .db <-> .dump
  • e3deac5 Merge branch 'main' into feat/x-ui-sh-migratedb
  • 5dd506d fix(x-ui.sh): address review feedback on migrateDB

📊 Changes

1 file changed (+102 additions, -0 deletions)

View changed files

📝 x-ui.sh (+102 -0)

📄 Description

Adds an x-ui migrateDB <file> subcommand and a PostgreSQL menu option (9) that convert between a SQLite .db and a portable .dump file.

  • Direction is auto-detected from the file extension (.db/.sqlite → dump, .dump/.sql → restore), falling back to the SQLite format 3 magic header.
  • No-arg form dumps the installed panel DB (/etc/x-ui/x-ui.db).
  • Conversion is delegated to the bundled binary (x-ui migrate-db --dump/--restore), so no external sqlite3 client is installed or required.

Note on release timing

This depends on the matching binary support (migrate-db --dump/--restore), which is on main separately. It is therefore only usable from the next panel release — merge alongside that release.

Verification

  • bash -n x-ui.sh passes.
  • Round-trip tested on a real DB (2359 clients / 81 settings / 3825 client_inbounds): schema identical, integrity ok, sqlite_sequence preserved.

🔄 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/MHSanaei/3x-ui/pull/4910 **Author:** [@MHSanaei](https://github.com/MHSanaei) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/x-ui-sh-migratedb` --- ### 📝 Commits (3) - [`6ca2a3f`](https://github.com/MHSanaei/3x-ui/commit/6ca2a3f0f74e9e19151644eba614c54f79fd483a) feat(x-ui.sh): add migrateDB command and menu for SQLite .db <-> .dump - [`e3deac5`](https://github.com/MHSanaei/3x-ui/commit/e3deac536f4cdd1d46cc5decab9581d4a7a67715) Merge branch 'main' into feat/x-ui-sh-migratedb - [`5dd506d`](https://github.com/MHSanaei/3x-ui/commit/5dd506d2559ee7b81704732caf115ecebb83fc63) fix(x-ui.sh): address review feedback on migrateDB ### 📊 Changes **1 file changed** (+102 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `x-ui.sh` (+102 -0) </details> ### 📄 Description Adds an `x-ui migrateDB <file>` subcommand and a **PostgreSQL menu** option (9) that convert between a SQLite `.db` and a portable `.dump` file. - Direction is auto-detected from the file extension (`.db`/`.sqlite` → dump, `.dump`/`.sql` → restore), falling back to the `SQLite format 3` magic header. - No-arg form dumps the installed panel DB (`/etc/x-ui/x-ui.db`). - Conversion is delegated to the bundled binary (`x-ui migrate-db --dump/--restore`), so **no external `sqlite3` client** is installed or required. ### Note on release timing This depends on the matching binary support (`migrate-db --dump/--restore`), which is on `main` separately. It is therefore only usable from the next panel release — merge alongside that release. ### Verification - `bash -n x-ui.sh` passes. - Round-trip tested on a real DB (2359 clients / 81 settings / 3825 client_inbounds): schema identical, integrity `ok`, `sqlite_sequence` preserved. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:03:47 +07: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
MHSanaei/3x-ui#5748
No description provided.