From 460065ae853303babc0f33f3dfd63f14cddb913d Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Sun, 17 May 2026 03:18:41 +0000 Subject: [PATCH] fix(KB): align chunks_per_mb column type with TS contract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../migrations/1776100000001_create_kb_ratio_registry_table.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/database/migrations/1776100000001_create_kb_ratio_registry_table.ts b/admin/database/migrations/1776100000001_create_kb_ratio_registry_table.ts index fb0e38c..604e6e8 100644 --- a/admin/database/migrations/1776100000001_create_kb_ratio_registry_table.ts +++ b/admin/database/migrations/1776100000001_create_kb_ratio_registry_table.ts @@ -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)