import { BaseSchema } from '@adonisjs/lucid/schema' /** * The junk judge's locked rule by an index of the passworded releases (1.2M of 74M), not a scan of all of releases * every round (30 s; LOG.md 2026-10-19 (80)). And the posters of the spot inspector's own releases (source `spot`), * which it didn't add to posters: poster search, and the judge's scraped rule by posters, missed them. */ export default class extends BaseSchema { static disableTransactions = true async up() { this.schema.raw(`CREATE INDEX CONCURRENTLY IF NOT EXISTS releases_passworded_idx ON releases (id) WHERE passworded`) this.schema.raw( `INSERT INTO posters (poster) SELECT DISTINCT left(s.poster, 200) FROM spots s JOIN releases r ON r.id = s.release_id AND r.source = 'spot' WHERE s.poster IS NOT NULL ON CONFLICT DO NOTHING` ) } async down() { this.schema.raw(`DROP INDEX CONCURRENTLY IF EXISTS releases_passworded_idx`) } }