/** * @param { import("knex").Knex } knex * @returns { Promise } */ exports.up = function(knex) { return knex.schema .createTable('scheduledSubscriptions', table => { table.string('name').primary(); table.timestamp('next').defaultTo(knex.fn.now()); }) .createTable('subscriptions', table => { table.string('key') .references('name').inTable('scheduledSubscriptions'); table.string('channel'); table.string('guild').nullable(); }); }; /** * @param { import("knex").Knex } knex * @returns { Promise } */ exports.down = function(knex) { return knex.schema .dropTable('scheduledSubscriptions') .dropTable('subscriptions'); };