Goal
Widen the download-counter type in Rust from u32 to u64 and widen the corresponding database columns from INTEGER (32-bit, MySQL) to BIGINT (64-bit), delivered as a versioned sqlx migration so the change is explicit, testable, and tracked as a forward schema change.
Spec
docs/issues/1525-07-align-rust-and-db-types.md
Parent issue
Part of the persistence overhaul EPIC: #1525
Tasks
Acceptance Criteria
packages/tracker-core/migrations/sqlite/20260409120000_torrust_tracker_widen_download_counters.sql exists and is a comment-only no-op.
packages/tracker-core/migrations/mysql/20260409120000_torrust_tracker_widen_download_counters.sql exists and widens torrents.completed and torrent_aggregate_metrics.value to BIGINT.
NumberOfDownloads = u64 in packages/primitives/src/lib.rs.
SwarmMetadata.downloaded uses NumberOfDownloads; bare u32 is removed from that field.
- Both driver files use explicit
decode_counter / encode_counter helpers for all counter-column reads and writes.
encode_counter returns an error (not a panic, not silent truncation) for values above i64::MAX.
- A test verifies round-trip of a value larger than
u32::MAX for each backend.
- A test verifies the encode error path for values above
i64::MAX.
- No
as u32 casts or compiler-suppression attributes introduced by this subissue.
cargo test --workspace --all-targets passes.
linter all exits with code 0.
References
Goal
Widen the download-counter type in Rust from
u32tou64and widen the corresponding database columns fromINTEGER(32-bit, MySQL) toBIGINT(64-bit), delivered as a versionedsqlxmigration so the change is explicit, testable, and tracked as a forward schema change.Spec
docs/issues/1525-07-align-rust-and-db-types.md
Parent issue
Part of the persistence overhaul EPIC: #1525
Tasks
20260409120000_torrust_tracker_widen_download_counters.sqlfor bothsqlite/andmysql/)NumberOfDownloadsfromu32→u64, updateSwarmMetadata.downloaded, adddecode_counter/encode_counterhelpers to both drivers, fix all cascade compilation errorsencode_countererror on values abovei64::MAXAcceptance Criteria
packages/tracker-core/migrations/sqlite/20260409120000_torrust_tracker_widen_download_counters.sqlexists and is a comment-only no-op.packages/tracker-core/migrations/mysql/20260409120000_torrust_tracker_widen_download_counters.sqlexists and widenstorrents.completedandtorrent_aggregate_metrics.valuetoBIGINT.NumberOfDownloads = u64inpackages/primitives/src/lib.rs.SwarmMetadata.downloadedusesNumberOfDownloads; bareu32is removed from that field.decode_counter/encode_counterhelpers for all counter-column reads and writes.encode_counterreturns an error (not a panic, not silent truncation) for values abovei64::MAX.u32::MAXfor each backend.i64::MAX.as u32casts or compiler-suppression attributes introduced by this subissue.cargo test --workspace --all-targetspasses.linter allexits with code0.References