import { BaseSchema } from '@adonisjs/lucid/schema' /** * The prober's start puts a previous run's claims back (PendingLadder.release: status 9 → 0), which scanned the * 58M-row pending table on the HDD for 20+ minutes after every deploy (LOG.md (130)): 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 pending_releases_taken_idx ON pending_releases (release_key) WHERE status = 9` ) } async down() { this.schema.raw(`DROP INDEX CONCURRENTLY IF EXISTS pending_releases_taken_idx`) } }