import { BaseSchema } from '@adonisjs/lucid/schema' import env from '#start/env' /** * Phase 2's probe results (REBUILD.md, part 6): per release and probe kind * what its article showed (yEnc name, content type, a few names inside, * encryption), in CHUNK_TABLESPACE (the HDD) when set: they're read per * release, not searched. On the catalog only what search needs: whether the * release is passworded and its best inner name. */ export default class extends BaseSchema { async up() { const tablespace = env.get('CHUNK_TABLESPACE') const where = tablespace ? ` TABLESPACE ${tablespace}` : '' this.schema.raw(` CREATE TABLE release_inspections ( release_id bigint NOT NULL, kind varchar(8) NOT NULL, result jsonb NOT NULL, created_at timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (release_id, kind)${tablespace ? ` USING INDEX TABLESPACE ${tablespace}` : ''} )${where}`) this.schema.alterTable('releases', (table) => { table.boolean('passworded').nullable() table.string('inner_name', 255).nullable() table.timestamp('inspected_at', { useTz: true }).nullable() }) } async down() { this.schema.alterTable('releases', (table) => { table.dropColumn('passworded') table.dropColumn('inner_name') table.dropColumn('inspected_at') }) this.schema.dropTable('release_inspections') } }