Drop runId, update TaskStore interface

Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Co-authored-by: blam<ben@blam.sh>
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Johan Haals
2021-02-02 16:10:13 +01:00
parent 88c31ab16b
commit 6608f9f5ee
7 changed files with 168 additions and 121 deletions
@@ -31,10 +31,6 @@ exports.up = async function up(knex) {
.text('status')
.notNullable()
.comment('The current status of the task');
table
.integer('run_id')
.nullable()
.comment('The current run ID of the task');
table
.dateTime('created_at')
.defaultTo(knex.fn.now())
@@ -44,11 +40,6 @@ exports.up = async function up(knex) {
.dateTime('last_heartbeat_at')
.nullable()
.comment('The last timestamp when a heartbeat was received');
table
.integer('retry_count')
.notNullable()
.defaultTo(0)
.comment('The number of times that this task has been attempted');
});
await knex.schema.createTable('task_events', table => {
@@ -65,17 +56,13 @@ exports.up = async function up(knex) {
.notNullable()
.onDelete('CASCADE')
.comment('The task that generated the event');
table
.integer('run_id')
.nullable()
.comment('The run ID of the task that this event applies to');
table
.text('body')
.notNullable()
.comment('The JSON encoded body of the event');
table.text('event_type').notNullable().comment('The type of event');
table
.dateTime('created_at')
.timestamp('created_at', { precision: 9 })
.defaultTo(knex.fn.now())
.notNullable()
.comment('The timestamp when this event was generated');
@@ -90,7 +77,7 @@ exports.up = async function up(knex) {
exports.down = async function down(knex) {
if (knex.client.config.client !== 'sqlite3') {
await knex.schema.alterTable('task_events', table => {
table.dropIndex([], 'task_events_task_id_idx');
table.dropIndex([], 'ctask_events_task_id_idx');
});
}
await knex.schema.dropTable('task_events');