import { BaseSchema } from '@adonisjs/lucid/schema' /** * Deferred articles whose headers don't say which file they belong to * (ngPost with random subjects and a new poster every few articles, see * CONCEPT.md D28). Only the article range per fetch batch is kept; * `deferred:expand-ranges` finds the articles again and queues their bodies. */ export default class extends BaseSchema { async up() { this.schema.createTable('deferred_ranges', (table) => { table.bigIncrements('id') table.text('group_name').notNullable() table.bigInteger('first_article').notNullable() table.bigInteger('last_article').notNullable() table.integer('article_count').notNullable() table.bigInteger('bytes').notNullable() table.timestamp('created_at', { useTz: true }).notNullable() table.timestamp('expanded_at', { useTz: true }) table.index(['expanded_at', 'id']) table.index(['created_at']) }) } async down() { this.schema.dropTable('deferred_ranges') } }