import { BaseSchema } from '@adonisjs/lucid/schema' /** SFV grouping (CONCEPT.md D34) looks files up by their name. */ export default class extends BaseSchema { static disableTransactions = true async up() { // On the NVMe (default tablespace), like the files table's other indexes. await this.db.rawQuery(`CREATE INDEX CONCURRENTLY IF NOT EXISTS files_name_idx ON files ((coalesce(real_name, filename)))`) } async down() { await this.db.rawQuery(`DROP INDEX CONCURRENTLY IF EXISTS files_name_idx`) } }