28 lines
1002 B
TypeScript
28 lines
1002 B
TypeScript
import { BaseSchema } from '@adonisjs/lucid/schema'
|
|
|
|
/**
|
|
* The indexed groups (REBUILD.md, group list). `priority` decides a
|
|
* crosspost's owner: the indexed group in its Xref with the lowest number.
|
|
* New groups get numbers after the existing ones, so they never take
|
|
* articles from groups already done.
|
|
*/
|
|
export default class extends BaseSchema {
|
|
async up() {
|
|
this.schema.createTable('groups', (table) => {
|
|
table.increments('id')
|
|
table.string('name', 255).notNullable().unique()
|
|
table.integer('priority').notNullable().unique()
|
|
table.boolean('active').notNullable().defaultTo(true)
|
|
// From GROUP when planned: the server's oldest and newest article.
|
|
table.bigInteger('low').nullable()
|
|
table.bigInteger('high').nullable()
|
|
table.timestamp('planned_at', { useTz: true }).nullable()
|
|
table.timestamp('created_at', { useTz: true }).notNullable().defaultTo(this.now())
|
|
})
|
|
}
|
|
|
|
async down() {
|
|
this.schema.dropTable('groups')
|
|
}
|
|
}
|