Files
usenet-indexer/database/migrations/1770000000600_create_fragments.ts
T

25 lines
700 B
TypeScript

import { BaseSchema } from '@adonisjs/lucid/schema'
/**
* Segments of files cut off by a range's edge (REBUILD.md, fragments): kept
* by range, merged when the neighbouring range is done, then written as a
* chunk.
*/
export default class extends BaseSchema {
async up() {
this.schema.createTable('fragments', (table) => {
table.bigIncrements('id')
table.bigInteger('range_id').notNullable()
table.string('file_key', 40).notNullable()
table.bigInteger('article_number').notNullable()
table.jsonb('segment').notNullable()
table.index(['file_key'])
table.index(['range_id'])
})
}
async down() {
this.schema.dropTable('fragments')
}
}