2024-09-08 01:09:44 +00:00
|
|
|
exports.up = async (knex) => {
|
|
|
|
await knex.schema.createTable('scenes_revisions', (table) => {
|
|
|
|
table.increments('id');
|
|
|
|
|
|
|
|
table.integer('scene_id')
|
|
|
|
.notNullable()
|
|
|
|
.references('id')
|
2024-09-12 23:22:46 +00:00
|
|
|
.inTable('releases')
|
|
|
|
.onDelete('set null');
|
2024-09-08 01:09:44 +00:00
|
|
|
|
|
|
|
table.integer('user_id')
|
|
|
|
.references('id')
|
2024-09-12 23:22:46 +00:00
|
|
|
.inTable('users')
|
|
|
|
.onDelete('set null');
|
2024-09-08 01:09:44 +00:00
|
|
|
|
2024-09-12 23:22:46 +00:00
|
|
|
table.json('base')
|
|
|
|
.notNullable();
|
|
|
|
|
|
|
|
table.json('deltas')
|
|
|
|
.notNullable();
|
|
|
|
|
|
|
|
table.text('hash')
|
|
|
|
.notNullable();
|
2024-09-08 01:09:44 +00:00
|
|
|
|
|
|
|
table.text('comment');
|
|
|
|
|
2024-09-12 23:22:46 +00:00
|
|
|
table.boolean('approved');
|
|
|
|
|
|
|
|
table.integer('reviewed_by')
|
|
|
|
.references('id')
|
|
|
|
.inTable('users')
|
|
|
|
.onDelete('set null');
|
|
|
|
|
|
|
|
table.datetime('reviewed_at');
|
|
|
|
table.text('feedback');
|
|
|
|
|
2024-09-09 02:34:28 +00:00
|
|
|
table.datetime('applied_at');
|
2024-09-08 01:09:44 +00:00
|
|
|
|
2024-09-12 23:22:46 +00:00
|
|
|
table.datetime('created_at')
|
|
|
|
.notNullable()
|
|
|
|
.defaultTo(knex.fn.now());
|
|
|
|
});
|
|
|
|
|
|
|
|
await knex.schema.createTable('bans', (table) => {
|
|
|
|
table.increments('id');
|
|
|
|
|
|
|
|
table.integer('user_id')
|
|
|
|
.references('id')
|
|
|
|
.inTable('users')
|
|
|
|
.onDelete('set null');
|
|
|
|
|
|
|
|
table.string('username');
|
|
|
|
table.specificType('ip', 'cidr');
|
|
|
|
|
|
|
|
table.boolean('match_all')
|
|
|
|
.notNullable()
|
|
|
|
.defaultTo(false);
|
|
|
|
|
|
|
|
table.string('scope');
|
|
|
|
table.boolean('shadow');
|
|
|
|
|
|
|
|
table.integer('banned_by')
|
2024-09-08 01:09:44 +00:00
|
|
|
.references('id')
|
2024-09-12 23:22:46 +00:00
|
|
|
.inTable('users')
|
|
|
|
.onDelete('set null');
|
2024-09-08 01:09:44 +00:00
|
|
|
|
2024-09-12 23:22:46 +00:00
|
|
|
table.datetime('expires_at')
|
|
|
|
.notNullable();
|
2024-09-08 01:09:44 +00:00
|
|
|
|
|
|
|
table.datetime('created_at')
|
|
|
|
.notNullable()
|
|
|
|
.defaultTo(knex.fn.now());
|
|
|
|
});
|
2024-09-12 23:22:46 +00:00
|
|
|
|
|
|
|
await knex.schema.alterTable('users', (table) => {
|
|
|
|
table.specificType('last_ip', 'cidr');
|
|
|
|
});
|
2024-09-08 01:09:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.down = async (knex) => {
|
|
|
|
await knex.schema.dropTable('scenes_revisions');
|
2024-09-12 23:22:46 +00:00
|
|
|
await knex.schema.dropTable('bans');
|
|
|
|
|
|
|
|
await knex.schema.alterTable('users', (table) => {
|
|
|
|
table.dropColumn('last_ip');
|
|
|
|
});
|
2024-09-08 01:09:44 +00:00
|
|
|
};
|