import { BaseSchema } from '@adonisjs/lucid/schema' /** * The prober's start puts a previous run's claims back (probe_candidates status taken → waiting), which scanned * the 7.8 GB candidates table on the HDD for 4 minutes after every deploy (LOG.md (133)): a partial index on the * few taken rows makes it instant. */ export default class extends BaseSchema { static disableTransactions = true async up() { this.schema.raw( `CREATE INDEX CONCURRENTLY IF NOT EXISTS probe_candidates_taken_idx ON probe_candidates (id) WHERE status = 'taken'` ) } async down() { this.schema.raw(`DROP INDEX CONCURRENTLY IF EXISTS probe_candidates_taken_idx`) } }