import { BaseSchema } from '@adonisjs/lucid/schema' /** * Files that are still being collected from XOVER. One row per uploaded file, * identified by file_key (see lib/subject/file_key.ts). */ export default class extends BaseSchema { protected tableName = 'binaries' async up() { this.schema.createTable(this.tableName, (table) => { table.bigIncrements('id') table.string('file_key', 40).notNullable().unique() table.text('poster').notNullable() table.text('subject').notNullable() table.text('name').notNullable() table.integer('total_parts').notNullable() table.jsonb('groups').notNullable() table.timestamp('posted_at', { useTz: true }) table.timestamp('first_seen_at', { useTz: true }).notNullable() table.timestamp('last_seen_at', { useTz: true }).notNullable().index() table.timestamp('completed_at', { useTz: true }) // Set when two different articles claim the same part number (see IngestService). table.timestamp('conflicted_at', { useTz: true }) table.integer('file_id').unsigned().references('files.id').onDelete('SET NULL') }) } async down() { this.schema.dropTable(this.tableName) } }