Files
usenet-indexer/database/migrations/1770000002700_release_inspections_catalog_tablespace.ts
T
Daan MeijerandClaude Opus 5.5 8e4ed774c0
Test and deploy / test (push) Successful in 53s
Test and deploy / edge (push) Successful in 2m7s
Test and deploy / deploy (push) Successful in 2m33s
release_inspections in the catalog's tablespace (the NVMe)
The prober writes it every flush and the merger looks inner stems up in it,
so it no longer belongs with the write-once payloads on the HDD. Moved on
homelab by hand (prober and merger stopped); the migration is a no-op there
and moves it on a new deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 10:09:20 +02:00

28 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { BaseSchema } from '@adonisjs/lucid/schema'
/**
* release_inspections in the catalog's tablespace (default_tablespace: nvme
* on homelab), not CHUNK_TABLESPACE: the prober writes it every flush and
* the merger looks stems up in it (release_inspections_inner_stem_idx), so it
* isn't only read per release any more (migration 1700). Its flushes took
* 35–83 s a minute with the table on the HDD (LOG.md 2026-10-13 (43)).
* Homelab was moved by hand first; here a no-op when it's there already, or
* without a default tablespace (tests).
*/
export default class extends BaseSchema {
async up() {
this.defer(async (db) => {
const { rows } = await db.rawQuery(
`SELECT current_setting('default_tablespace') AS target,
(SELECT t.spcname FROM pg_class c LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace WHERE c.relname = 'release_inspections') AS current`
)
const { target, current } = rows[0]
if (!target || current === target) return
await db.rawQuery(`ALTER TABLE release_inspections SET TABLESPACE ${target}`)
await db.rawQuery(`ALTER INDEX release_inspections_pkey SET TABLESPACE ${target}`)
})
}
async down() {}
}