[GH-ISSUE #5017] [Bug]: v.3.2.8 Node traffic sync: merge for {node_name} failed: ERROR: CASE types boolean and integer cannot be matched (SQLSTATE 42804) #3529

Closed
opened 2026-10-31 20:33:06 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @shart7 on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5017

Describe the bug

The error appeared after changing the database to PostgreSQL. As I understand it, this is an error of incompatibility of Postgresql and SQLite database variables.

How to reproduce the problem

Add one or more nodes to the panel and view the logs.

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.2.8

Xray-core version

26.6.1

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 24.04

Which parts of the panel are affected?

Statistics / traffic counters

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

No — direct access

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @shart7 on GitHub (Jun 6, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5017 ### Describe the bug The error appeared after changing the database to PostgreSQL. As I understand it, this is an error of incompatibility of Postgresql and SQLite database variables. ### How to reproduce the problem Add one or more nodes to the panel and view the logs. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.2.8 ### Xray-core version 26.6.1 ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 24.04 ### Which parts of the panel are affected? Statistics / traffic counters ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? No — direct access ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:33:06 +07:00
Author
Owner

@wangzhijie0602 commented on GitHub (Jun 6, 2026):

#4970

<!-- gh-comment-id:4639411893 --> @wangzhijie0602 commented on GitHub (Jun 6, 2026): #4970
Author
Owner

@github-actions[bot] commented on GitHub (Jun 6, 2026):

Thanks for the detailed report. I traced this through the source code.

What's happening

The error originates in web/service/inbound.go inside setRemoteTrafficLocked, which runs during every node traffic-sync cycle. For each client stat received from the node it executes (simplified):

UPDATE client_traffics
SET up = up + $1, down = down + $2,
    enable  = enable AND $3,
    total   = $4, expiry_time = $5, reset = $6,
    last_online = GREATEST(last_online, $7)
WHERE email = $8

PostgreSQL raises "CASE types boolean and integer cannot be matched" (SQLSTATE 42804) from the GREATEST(last_online, $7) call when the two arguments have incompatible types — specifically when last_online is stored as boolean in the database while the Go code passes it as bigint (int64). GREATEST (and LEAST, COALESCE, CASE) all use the same internal type-coercion path in PostgreSQL and produce this specific error on a mismatch.

The Go model declares LastOnline int64 (→ bigint); on a correctly created schema the column is bigint. The mismatch occurs when the PostgreSQL schema differs from what the current code expects — most often because:

  1. Incomplete/manual migration: the SQLite database was imported into PostgreSQL without running x-ui migrate-db, leaving boolean columns typed as integers (or vice-versa).
  2. Type change across upgrades: an older 3x-ui version stored last_online with a different type, and GORM's AutoMigrate on PostgreSQL adds new columns but never alters the type of existing columns, so the stale type is kept.

Diagnostic

Connect to your PostgreSQL database and run:

SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'client_traffics'
ORDER BY ordinal_position;

Expected types for the relevant columns:

column expected type
enable boolean
up, down, total, expiry_time, last_online bigint
reset integer

Similarly check the inbounds table:

SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'inbounds'
ORDER BY ordinal_position;

enable there must also be boolean.

Fix

Preferred (clean slate): Re-run the built-in migration tool, which calls AutoMigrate first (creating the correct schema) then copies your data:

x-ui migrate-db --dsn "postgres://user:password@host:5432/dbname"

Then set XUI_DB_TYPE=postgres and XUI_DB_DSN=... in /etc/default/x-ui and restart.

If you need to fix in-place (after identifying the mismatched columns):

-- If last_online is boolean instead of bigint:
ALTER TABLE client_traffics
  ALTER COLUMN last_online TYPE bigint
  USING CASE WHEN last_online THEN 1 ELSE 0 END;

-- If enable is integer instead of boolean:
ALTER TABLE client_traffics
  ALTER COLUMN enable TYPE boolean
  USING CASE WHEN enable = 1 THEN true ELSE false END;

ALTER TABLE inbounds
  ALTER COLUMN enable TYPE boolean
  USING CASE WHEN enable = 1 THEN true ELSE false END;

Run systemctl restart x-ui after any schema change.

Clarification needed

To help pinpoint the exact cause, please share:

  1. The output of the two SELECT column_name, data_type ... queries above.
  2. How you switched from SQLite to PostgreSQL — did you use x-ui migrate-db, a manual dump/restore, or something else?
  3. Whether you upgraded 3x-ui while already on PostgreSQL (if so, from which version).
<!-- gh-comment-id:4639418387 --> @github-actions[bot] commented on GitHub (Jun 6, 2026): Thanks for the detailed report. I traced this through the source code. ## What's happening The error originates in `web/service/inbound.go` inside `setRemoteTrafficLocked`, which runs during every node traffic-sync cycle. For each client stat received from the node it executes (simplified): ```sql UPDATE client_traffics SET up = up + $1, down = down + $2, enable = enable AND $3, total = $4, expiry_time = $5, reset = $6, last_online = GREATEST(last_online, $7) WHERE email = $8 ``` PostgreSQL raises **"CASE types boolean and integer cannot be matched" (SQLSTATE 42804)** from the `GREATEST(last_online, $7)` call when the two arguments have incompatible types — specifically when `last_online` is stored as `boolean` in the database while the Go code passes it as `bigint` (`int64`). `GREATEST` (and `LEAST`, `COALESCE`, `CASE`) all use the same internal type-coercion path in PostgreSQL and produce this specific error on a mismatch. The Go model declares `LastOnline int64` (→ `bigint`); on a correctly created schema the column is `bigint`. The mismatch occurs when the PostgreSQL schema differs from what the current code expects — most often because: 1. **Incomplete/manual migration**: the SQLite database was imported into PostgreSQL without running `x-ui migrate-db`, leaving boolean columns typed as integers (or vice-versa). 2. **Type change across upgrades**: an older 3x-ui version stored `last_online` with a different type, and GORM's `AutoMigrate` on PostgreSQL **adds** new columns but **never alters the type of existing columns**, so the stale type is kept. ## Diagnostic Connect to your PostgreSQL database and run: ```sql SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'client_traffics' ORDER BY ordinal_position; ``` Expected types for the relevant columns: | column | expected type | |---|---| | `enable` | `boolean` | | `up`, `down`, `total`, `expiry_time`, `last_online` | `bigint` | | `reset` | `integer` | Similarly check the `inbounds` table: ```sql SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'inbounds' ORDER BY ordinal_position; ``` `enable` there must also be `boolean`. ## Fix **Preferred (clean slate):** Re-run the built-in migration tool, which calls `AutoMigrate` first (creating the correct schema) then copies your data: ```bash x-ui migrate-db --dsn "postgres://user:password@host:5432/dbname" ``` Then set `XUI_DB_TYPE=postgres` and `XUI_DB_DSN=...` in `/etc/default/x-ui` and restart. **If you need to fix in-place** (after identifying the mismatched columns): ```sql -- If last_online is boolean instead of bigint: ALTER TABLE client_traffics ALTER COLUMN last_online TYPE bigint USING CASE WHEN last_online THEN 1 ELSE 0 END; -- If enable is integer instead of boolean: ALTER TABLE client_traffics ALTER COLUMN enable TYPE boolean USING CASE WHEN enable = 1 THEN true ELSE false END; ALTER TABLE inbounds ALTER COLUMN enable TYPE boolean USING CASE WHEN enable = 1 THEN true ELSE false END; ``` Run `systemctl restart x-ui` after any schema change. ## Clarification needed To help pinpoint the exact cause, please share: 1. The output of the two `SELECT column_name, data_type ...` queries above. 2. How you switched from SQLite to PostgreSQL — did you use `x-ui migrate-db`, a manual dump/restore, or something else? 3. Whether you upgraded 3x-ui while already on PostgreSQL (if so, from which version).
Author
Owner

@shart7 commented on GitHub (Jun 7, 2026):

Hello!

How you switched from SQLite to PostgreSQL — did you use x-ui migrate-db,
a manual dump/restore, or something else?

I use x-ui migrate-db (menu item 27 -> 2)

Whether you upgraded 3x-ui while already on PostgreSQL (if so, from which
version).

No, I decided to migrate to PostgeSQL using v.3.2.8, before that I used
SQLite.

I use only the original script for installation 3x-ui panel. Today, I tried
to switch to an SQLite database twice, deleted and recreated the PostgreSQL
database using x-ui migrate-db, but the error still persists.

On Sat, Jun 6, 2026 at 6:48 PM Sanaei @.***> wrote:

Closed #5017 https://github.com/MHSanaei/3x-ui/issues/5017 as not
planned.

—
Reply to this email directly, view it on GitHub
https://github.com/MHSanaei/3x-ui/issues/5017?email_source=notifications&email_token=BGRD5NZ33SVZJ3IZIYE73GL46Q4OLA5CNFSNUABQM5UWIORPF5TWS5BNNB2WEL2JONZXKZKFOZSW45CON52GSZTJMNQXI2LPNYXTENRUGI2DAMBRGA4TRJTSMVQXG33OUZQXK5DIN5ZKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#event-26424001098,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BGRD5N63O6VYMCOUQSO54WL46Q4OLAVCNFSM6AAAAACZ5F6URCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMRWGQZDIMBQGEYDSOA
.
You are receiving this because you authored the thread.Message ID:
@.***>

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'api_tokens'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
id | bigint
name | text
token | text
enabled | boolean
created_at | bigint
(5 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'client_group'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
(0 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'client_inbound'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
(0 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'client_traffics'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
id | bigint
inbound_id | bigint
enable | boolean
email | text
up | bigint
down | bigint
expiry_time | bigint
total | bigint
reset | bigint
last_online | bigint
(10 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'clients'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
id | bigint
email | text
sub_id | text
uuid | text
password | text
auth | text
flow | text
security | text
reverse | text
limit_ip | bigint
total_gb | bigint
expiry_time | bigint
enable | boolean
tg_id | bigint
group_name | text
comment | text
reset | bigint
created_at | bigint
updated_at | bigint
(19 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'custom_geo_resources'
ORDER BY ordinal_position;
column_name | data_type
-----------------+-----------
id | bigint
geo_type | text
alias | text
url | text
local_path | text
last_updated_at | bigint
last_modified | text
created_at | bigint
updated_at | bigint
(9 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'history_of_seeders'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
id | bigint
seeder_name | text
(2 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'inbound_client_ips'
ORDER BY ordinal_position;
column_name | data_type
--------------+-----------
id | bigint
client_email | text
ips | text
(3 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'inbound_fallbacks'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
id | bigint
master_id | bigint
child_id | bigint
name | text
alpn | text
path | text
dest | text
xver | bigint
sort_order | bigint
(9 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'inbounds'
ORDER BY ordinal_position;
column_name | data_type
-------------------------+-----------
id | bigint
user_id | bigint
up | bigint
down | bigint
total | bigint
remark | text
enable | boolean
expiry_time | bigint
traffic_reset | text
last_traffic_reset_time | bigint
listen | text
port | bigint
protocol | text
settings | text
stream_settings | text
tag | text
sniffing | text
node_id | bigint
(18 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'node_client_traffics'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
id | bigint
node_id | bigint
email | text
up | bigint
down | bigint
(5 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'nodes'
ORDER BY ordinal_position;
column_name | data_type
-----------------------+-----------
id | bigint
name | text
remark | text
scheme | text
address | text
port | bigint
base_path | text
api_token | text
enable | boolean
allow_private_address | boolean
tls_verify_mode | text
pinned_cert_sha256 | text
status | text
last_heartbeat | bigint
latency_ms | bigint
xray_version | text
panel_version | text
cpu_pct | numeric
mem_pct | numeric
uptime_secs | bigint
last_error | text
config_dirty | boolean
config_dirty_at | bigint
created_at | bigint
updated_at | bigint
(25 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'outbound_traffics'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
id | bigint
tag | text
up | bigint
down | bigint
total | bigint
(5 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'settings'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
id | bigint
key | text
value | text
(3 rows)

xui=# SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'users'
ORDER BY ordinal_position;
column_name | data_type
-------------+-----------
id | bigint
username | text
password | text
login_epoch | bigint
(4 rows)
Please enter your selection [0-27]: 27
1. Install PostgreSQL (server + client + xui db)
2. Migrate SQLite -> PostgreSQL
3. Status (clusters & port 5432)
4. Start PostgreSQL
5. Stop PostgreSQL
6. Restart PostgreSQL
7. Enable Autostart on boot
8. View PostgreSQL Log
9. Convert SQLite .db <-> .dump
0. Back to Main Menu
Choose an option: 2

This copies your current SQLite data into a PostgreSQL database,
then switches the panel to PostgreSQL and restarts it.
Any existing panel tables in the destination will be cleared and overwritten.

Continue? [Default n]: y

    1. Install PostgreSQL locally and create a dedicated user/db (recommended)
    2. Use an existing PostgreSQL server (enter DSN)

Choose [1]: 1
[INF] Installing PostgreSQL locally (this may take a moment)...
Hit:1 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:2 https://download.docker.com/linux/ubuntu noble InRelease
Hit:3 http://archive.ubuntu.com/ubuntu noble InRelease
Hit:4 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Reading package lists... Done
Reading package lists...
Building dependency tree...
Reading state information...
postgresql is already the newest version (16+257build1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Synchronizing state of postgresql.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable postgresql
CREATE ROLE
CREATE DATABASE
ALTER ROLE
[INF] Stopping panel to take a consistent snapshot...

[INF] Migrating data into PostgreSQL...
2026/06/07 15:48:47 Creating destination schema...
2026/06/07 15:48:48 Clearing destination tables...
2026/06/07 15:48:48 User 1 rows
2026/06/07 15:48:48 Setting 85 rows
2026/06/07 15:48:48 HistoryOfSeeders 10 rows
2026/06/07 15:48:48 CustomGeoResource 0 rows
2026/06/07 15:48:48 Node 2 rows
2026/06/07 15:48:48 ApiToken 1 rows
2026/06/07 15:48:48 Inbound 4 rows
2026/06/07 15:48:48 ClientTraffic 12 rows
2026/06/07 15:48:48 OutboundTraffics 0 rows
2026/06/07 15:48:48 InboundClientIps 0 rows
2026/06/07 15:48:48 ClientRecord 12 rows
2026/06/07 15:48:48 ClientInbound 22 rows
2026/06/07 15:48:48 InboundFallback 0 rows
2026/06/07 15:48:48 NodeClientTraffic 2 rows
2026/06/07 15:48:48 Migration complete: 151 rows across 14 tables.
2026/06/07 15:48:48 Set XUI_DB_TYPE=postgres and XUI_DB_DSN=... in /etc/default/x-ui, then restart x-ui.
The OS release is: ubuntu
Arch: amd64
Running...
Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://security.ubuntu.com/ubuntu noble-security InRelease
Hit:3 https://download.docker.com/linux/ubuntu noble InRelease
Hit:4 http://archive.ubuntu.com/ubuntu noble-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Reading package lists... Done
Reading package lists...
Building dependency tree...
Reading state information...
cron is already the newest version (3.0pl1-184ubuntu2).
curl is already the newest version (8.5.0-2ubuntu10.9).
tar is already the newest version (1.35+dfsg-3build1).
tzdata is already the newest version (2026a-0ubuntu0.24.04.1).
socat is already the newest version (1.8.0.0-4build3).
ca-certificates is already the newest version (20240203).
openssl is already the newest version (3.0.13-0ubuntu3.9).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Got x-ui latest version: v3.2.8, beginning the installation...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 72.9M 100 72.9M 0 0 73.3M 0 --:--:-- --:--:-- --:--:-- 101M
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 111k 100 111k 0 0 450k 0 --:--:-- --:--:-- --:--:-- 452k
x-ui/
x-ui/x-ui.sh
x-ui/x-ui.service.debian
x-ui/x-ui
x-ui/x-ui.service.rhel
x-ui/bin/
x-ui/bin/geosite_RU.dat
x-ui/bin/geoip.dat
x-ui/bin/LICENSE
x-ui/bin/geoip_IR.dat
x-ui/bin/geosite_IR.dat
x-ui/bin/xray-linux-amd64
x-ui/bin/geosite.dat
x-ui/bin/geoip_RU.dat
x-ui/bin/README.md
x-ui/x-ui.service.arch
Username, Password, and WebBasePath are properly set.
SSL certificate already configured. No action needed.
Start migrating database...
Migration done!
Found x-ui.service.debian in extracted files, installing...
Setting up systemd unit...
x-ui v3.2.8 installation finished, it is running now...

<!-- gh-comment-id:4643240701 --> @shart7 commented on GitHub (Jun 7, 2026): Hello! *How you switched from SQLite to PostgreSQL — did you use x-ui migrate-db, a manual dump/restore, or something else?* I use x-ui migrate-db (menu item 27 -> 2) *Whether you upgraded 3x-ui while already on PostgreSQL (if so, from which version).* No, I decided to migrate to PostgeSQL using v.3.2.8, before that I used SQLite. I use only the original script for installation 3x-ui panel. Today, I tried to switch to an SQLite database twice, deleted and recreated the PostgreSQL database using x-ui migrate-db, but the error still persists. On Sat, Jun 6, 2026 at 6:48 PM Sanaei ***@***.***> wrote: > Closed #5017 <https://github.com/MHSanaei/3x-ui/issues/5017> as not > planned. > > — > Reply to this email directly, view it on GitHub > <https://github.com/MHSanaei/3x-ui/issues/5017?email_source=notifications&email_token=BGRD5NZ33SVZJ3IZIYE73GL46Q4OLA5CNFSNUABQM5UWIORPF5TWS5BNNB2WEL2JONZXKZKFOZSW45CON52GSZTJMNQXI2LPNYXTENRUGI2DAMBRGA4TRJTSMVQXG33OUZQXK5DIN5ZKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#event-26424001098>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/BGRD5N63O6VYMCOUQSO54WL46Q4OLAVCNFSM6AAAAACZ5F6URCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMRWGQZDIMBQGEYDSOA> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> > xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'api_tokens' ORDER BY ordinal_position; column_name | data_type -------------+----------- id | bigint name | text token | text enabled | boolean created_at | bigint (5 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'client_group' ORDER BY ordinal_position; column_name | data_type -------------+----------- (0 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'client_inbound' ORDER BY ordinal_position; column_name | data_type -------------+----------- (0 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'client_traffics' ORDER BY ordinal_position; column_name | data_type -------------+----------- id | bigint inbound_id | bigint enable | boolean email | text up | bigint down | bigint expiry_time | bigint total | bigint reset | bigint last_online | bigint (10 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'clients' ORDER BY ordinal_position; column_name | data_type -------------+----------- id | bigint email | text sub_id | text uuid | text password | text auth | text flow | text security | text reverse | text limit_ip | bigint total_gb | bigint expiry_time | bigint enable | boolean tg_id | bigint group_name | text comment | text reset | bigint created_at | bigint updated_at | bigint (19 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'custom_geo_resources' ORDER BY ordinal_position; column_name | data_type -----------------+----------- id | bigint geo_type | text alias | text url | text local_path | text last_updated_at | bigint last_modified | text created_at | bigint updated_at | bigint (9 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'history_of_seeders' ORDER BY ordinal_position; column_name | data_type -------------+----------- id | bigint seeder_name | text (2 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'inbound_client_ips' ORDER BY ordinal_position; column_name | data_type --------------+----------- id | bigint client_email | text ips | text (3 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'inbound_fallbacks' ORDER BY ordinal_position; column_name | data_type -------------+----------- id | bigint master_id | bigint child_id | bigint name | text alpn | text path | text dest | text xver | bigint sort_order | bigint (9 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'inbounds' ORDER BY ordinal_position; column_name | data_type -------------------------+----------- id | bigint user_id | bigint up | bigint down | bigint total | bigint remark | text enable | boolean expiry_time | bigint traffic_reset | text last_traffic_reset_time | bigint listen | text port | bigint protocol | text settings | text stream_settings | text tag | text sniffing | text node_id | bigint (18 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'node_client_traffics' ORDER BY ordinal_position; column_name | data_type -------------+----------- id | bigint node_id | bigint email | text up | bigint down | bigint (5 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'nodes' ORDER BY ordinal_position; column_name | data_type -----------------------+----------- id | bigint name | text remark | text scheme | text address | text port | bigint base_path | text api_token | text enable | boolean allow_private_address | boolean tls_verify_mode | text pinned_cert_sha256 | text status | text last_heartbeat | bigint latency_ms | bigint xray_version | text panel_version | text cpu_pct | numeric mem_pct | numeric uptime_secs | bigint last_error | text config_dirty | boolean config_dirty_at | bigint created_at | bigint updated_at | bigint (25 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'outbound_traffics' ORDER BY ordinal_position; column_name | data_type -------------+----------- id | bigint tag | text up | bigint down | bigint total | bigint (5 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'settings' ORDER BY ordinal_position; column_name | data_type -------------+----------- id | bigint key | text value | text (3 rows) xui=# SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'users' ORDER BY ordinal_position; column_name | data_type -------------+----------- id | bigint username | text password | text login_epoch | bigint (4 rows) Please enter your selection [0-27]: 27 1. Install PostgreSQL (server + client + xui db) 2. Migrate SQLite -> PostgreSQL 3. Status (clusters & port 5432) 4. Start PostgreSQL 5. Stop PostgreSQL 6. Restart PostgreSQL 7. Enable Autostart on boot 8. View PostgreSQL Log 9. Convert SQLite .db <-> .dump 0. Back to Main Menu Choose an option: 2 This copies your current SQLite data into a PostgreSQL database, then switches the panel to PostgreSQL and restarts it. Any existing panel tables in the destination will be cleared and overwritten. Continue? [Default n]: y 1. Install PostgreSQL locally and create a dedicated user/db (recommended) 2. Use an existing PostgreSQL server (enter DSN) Choose [1]: 1 [INF] Installing PostgreSQL locally (this may take a moment)... Hit:1 http://security.ubuntu.com/ubuntu noble-security InRelease Hit:2 https://download.docker.com/linux/ubuntu noble InRelease Hit:3 http://archive.ubuntu.com/ubuntu noble InRelease Hit:4 http://archive.ubuntu.com/ubuntu noble-updates InRelease Hit:5 http://archive.ubuntu.com/ubuntu noble-backports InRelease Reading package lists... Done Reading package lists... Building dependency tree... Reading state information... postgresql is already the newest version (16+257build1.1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Synchronizing state of postgresql.service with SysV service script with /usr/lib/systemd/systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable postgresql CREATE ROLE CREATE DATABASE ALTER ROLE [INF] Stopping panel to take a consistent snapshot... [INF] Migrating data into PostgreSQL... 2026/06/07 15:48:47 Creating destination schema... 2026/06/07 15:48:48 Clearing destination tables... 2026/06/07 15:48:48 User 1 rows 2026/06/07 15:48:48 Setting 85 rows 2026/06/07 15:48:48 HistoryOfSeeders 10 rows 2026/06/07 15:48:48 CustomGeoResource 0 rows 2026/06/07 15:48:48 Node 2 rows 2026/06/07 15:48:48 ApiToken 1 rows 2026/06/07 15:48:48 Inbound 4 rows 2026/06/07 15:48:48 ClientTraffic 12 rows 2026/06/07 15:48:48 OutboundTraffics 0 rows 2026/06/07 15:48:48 InboundClientIps 0 rows 2026/06/07 15:48:48 ClientRecord 12 rows 2026/06/07 15:48:48 ClientInbound 22 rows 2026/06/07 15:48:48 InboundFallback 0 rows 2026/06/07 15:48:48 NodeClientTraffic 2 rows 2026/06/07 15:48:48 Migration complete: 151 rows across 14 tables. 2026/06/07 15:48:48 Set XUI_DB_TYPE=postgres and XUI_DB_DSN=... in /etc/default/x-ui, then restart x-ui. The OS release is: ubuntu Arch: amd64 Running... Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease Hit:2 http://security.ubuntu.com/ubuntu noble-security InRelease Hit:3 https://download.docker.com/linux/ubuntu noble InRelease Hit:4 http://archive.ubuntu.com/ubuntu noble-updates InRelease Hit:5 http://archive.ubuntu.com/ubuntu noble-backports InRelease Reading package lists... Done Reading package lists... Building dependency tree... Reading state information... cron is already the newest version (3.0pl1-184ubuntu2). curl is already the newest version (8.5.0-2ubuntu10.9). tar is already the newest version (1.35+dfsg-3build1). tzdata is already the newest version (2026a-0ubuntu0.24.04.1). socat is already the newest version (1.8.0.0-4build3). ca-certificates is already the newest version (20240203). openssl is already the newest version (3.0.13-0ubuntu3.9). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Got x-ui latest version: v3.2.8, beginning the installation... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 72.9M 100 72.9M 0 0 73.3M 0 --:--:-- --:--:-- --:--:-- 101M % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 111k 100 111k 0 0 450k 0 --:--:-- --:--:-- --:--:-- 452k x-ui/ x-ui/x-ui.sh x-ui/x-ui.service.debian x-ui/x-ui x-ui/x-ui.service.rhel x-ui/bin/ x-ui/bin/geosite_RU.dat x-ui/bin/geoip.dat x-ui/bin/LICENSE x-ui/bin/geoip_IR.dat x-ui/bin/geosite_IR.dat x-ui/bin/xray-linux-amd64 x-ui/bin/geosite.dat x-ui/bin/geoip_RU.dat x-ui/bin/README.md x-ui/x-ui.service.arch Username, Password, and WebBasePath are properly set. SSL certificate already configured. No action needed. Start migrating database... Migration done! Found x-ui.service.debian in extracted files, installing... Setting up systemd unit... x-ui v3.2.8 installation finished, it is running now...
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#3529
No description provided.