import { BaseSchema } from '@adonisjs/lucid/schema' /** * Stored parts per binary, kept by IngestService as it inserts parts * (LOG.md 2026-10-06 (7)). claimCompleted counted every binary's parts in * every batch (15% of Postgres' active time); a binary of thousands of * parts that gets a few per batch was counted thousands of times. NULL: * not counted yet (binaries from before), counted exactly on the next new * part. Only parts of binaries without a file are deleted, so it stays exact * until a binary completes. */ export default class extends BaseSchema { async up() { await this.db.rawQuery(`SET LOCAL lock_timeout = '2min'`) await this.db.rawQuery(`ALTER TABLE binaries ADD COLUMN IF NOT EXISTS part_count integer`) } async down() { await this.db.rawQuery(`ALTER TABLE binaries DROP COLUMN IF EXISTS part_count`) } }