jillo-bot/migrations/20231112182439_subscription...

28 lines
707 B
JavaScript

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
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<void> }
*/
exports.down = function(knex) {
return knex.schema
.dropTable('scheduledSubscriptions')
.dropTable('subscriptions');
};