3x-ui/database
MHSanaei 998fa0dfe1
fix(postgres): stop FK constraint from blocking inbound delete
The schema was written for SQLite, which never enforces foreign keys, so
relationships are managed in application code and deleting an inbound keeps
its client_traffics by design. On Postgres GORM auto-created the
fk_inbounds_client_stats constraint, which rejected those deletes with
SQLSTATE 23503.

Set DisableForeignKeyConstraintWhenMigrating so neither backend creates the
constraint, and drop the already-created one on existing Postgres DBs via
dropLegacyForeignKeys. Also revert the client_traffics deletion that
c20ee00f added to DelInbound so traffic is preserved.
2026-05-31 21:45:41 +02:00
..
model feat(fallbacks): add per-rule dest override 2026-05-28 21:17:49 +02:00
db.go fix(postgres): stop FK constraint from blocking inbound delete 2026-05-31 21:45:41 +02:00
db_seed_test.go test: name temp sqlite db x-ui.db to match the real db filename 2026-05-31 15:25:05 +02:00
dialect.go fix(nodes): use GREATEST for last_online merge on PostgreSQL 2026-05-29 02:04:02 +02:00
migrate_data.go Feat/multi inbound clients (#4469) 2026-05-19 12:20:24 +02:00