41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { BaseSchema } from '@adonisjs/lucid/schema'
|
|
|
|
/**
|
|
* Spotnet spots (CONCEPT.md D29): signed posts in free.pt that point to a
|
|
* compressed NZB. Filled from headers by worker:fetch, then worker:spots
|
|
* verifies each spot, reads its NZB and imports it as a release.
|
|
*/
|
|
export default class extends BaseSchema {
|
|
async up() {
|
|
this.schema.createTable('spots', (table) => {
|
|
table.text('message_id').primary()
|
|
table.text('group_name').notNullable()
|
|
table.bigInteger('article_number')
|
|
table.text('title').notNullable()
|
|
table.text('tag')
|
|
table.text('poster').notNullable()
|
|
table.integer('category')
|
|
table.jsonb('subcats')
|
|
table.bigInteger('size')
|
|
table.timestamp('posted_at', { useTz: true })
|
|
table.integer('key_id')
|
|
// Spotweb's spotter id (CRC of the poster's key), to check personal disposes.
|
|
table.text('spotter_id')
|
|
// pending → imported, or unverified / no-nzb / moderation / removed / failed.
|
|
table.string('status', 16).notNullable().defaultTo('pending')
|
|
table.bigInteger('release_id').references('releases.id').onDelete('SET NULL')
|
|
table.text('website')
|
|
table.text('error')
|
|
table.timestamp('created_at', { useTz: true }).notNullable()
|
|
table.timestamp('processed_at', { useTz: true })
|
|
table.index(['status', 'created_at'])
|
|
table.index(['release_id'])
|
|
table.index(['status', 'release_id'])
|
|
})
|
|
}
|
|
|
|
async down() {
|
|
this.schema.dropTable('spots')
|
|
}
|
|
}
|