mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-28 07:36:38 +08:00
e0dd70a054
Widens legacy PostgreSQL traffic/quota columns to BIGINT to prevent int4 overflow when storing large values like 536870912000 (500GB). Affected tables: - user (flow, in_flow, out_flow) - forward (in_flow, out_flow) - statistics_flow (flow, total_flow) - tunnel (flow) - user_tunnel (flow, in_flow, out_flow) - peer_share (max_bandwidth, current_flow) Schema version bumped from 4 to 5 with auto-migration on startup.
983 B
983 B
019 Federation Share Traffic Bigint Migration
Checklist
- Inspect federation share creation failure and identify the PostgreSQL
int4overflow source. - Audit other traffic-related legacy PostgreSQL columns that may still be
integerdespite Go models usingint64. - Add a schema migration that widens legacy traffic/quota columns from
integertobigint. - Add migration tests covering the new schema version branch and error propagation.
- Run focused backend verification for the migration changes.
Notes
- The reported failing value
536870912000is 500 GiB in bytes and overflows PostgreSQLint4. - The fix widens historical PostgreSQL traffic columns in
user,forward,statistics_flow,tunnel,user_tunnel, andpeer_sharetoBIGINTwhen needed.
Test Record
- Command:
cd go-backend && go test ./internal/store/repo/... - Result: passed.
- Command:
cd go-backend && go test ./tests/contract/... - Result: passed.