Initial commit in new repository

This commit is contained in:
Dragory 2018-07-01 03:35:51 +03:00
commit 23c78f2c9c
15 changed files with 4048 additions and 0 deletions

View file

@ -0,0 +1,30 @@
exports.up = async function(knex, Promise) {
await knex.schema.createTableIfNotExists('mod_actions', table => {
table.increments('id');
table.bigInteger('guild_id').unsigned().notNullable();
table.integer('case_number').unsigned().notNullable();
table.bigInteger('user_id').index().unsigned().notNullable();
table.string('user_name', 128).notNullable();
table.bigInteger('mod_id').index().unsigned().nullable().defaultTo(null);
table.string('mod_name', 128).nullable().defaultTo(null);
table.string('action_type', 16).notNullable();
table.bigInteger('audit_log_id').unique().nullable().defaultTo(null);
table.dateTime('created_at').index().defaultTo(knex.raw('NOW()')).notNullable();
table.unique(['guild_id', 'case_number']);
});
await knex.schema.createTableIfNotExists('mod_action_notes', table => {
table.increments('id');
table.integer('mod_action_id').unsigned().notNullable().index().references('id').inTable('mod_actions').onDelete('CASCADE');
table.bigInteger('mod_id').index().unsigned().nullable().defaultTo(null);
table.string('mod_name', 128).nullable().defaultTo(null);
table.text('body').notNullable();
table.dateTime('created_at').index().defaultTo(knex.raw('NOW()')).notNullable();
});
};
exports.down = async function(knex, Promise) {
await knex.schema.dropTableIfExists('mod_action_notes');
await knex.schema.dropTableIfExists('mod_actions');
};