fix(KB): align chunks_per_mb column type with TS contract

Switch kb_ratio_registry.chunks_per_mb from DECIMAL(10,2) to UNSIGNED
INTEGER so the value mysql2 returns matches the `number` type declared
on the model. DECIMAL columns deserialize as strings by default, which
would break `=== 0` checks for video-only ZIMs and silently coerce
through arithmetic in Phase 2 consumers.

All seeds are whole numbers and the heuristic's real-world variance
(~±50%) makes sub-integer precision meaningless.
This commit is contained in:
Jake Turner 2026-05-17 03:18:41 +00:00 committed by Jake Turner
parent 68e1bd5ff2
commit 460065ae85

View File

@ -42,7 +42,7 @@ export default class extends BaseSchema {
this.schema.createTable(this.tableName, (table) => {
table.increments('id').primary()
table.string('pattern', 255).notNullable().unique()
table.decimal('chunks_per_mb', 10, 2).notNullable()
table.integer('chunks_per_mb').unsigned().notNullable()
// 0 = heuristic seed, >0 = number of observed ZIMs that have updated this entry.
// Phase 4 self-calibration increments this on each successful ingestion.
table.integer('sample_count').notNullable().defaultTo(0)