36 lines
902 B
JavaScript
36 lines
902 B
JavaScript
const NULL_UUID = '00000000-0000-0000-0000-000000000000';
|
|
|
|
exports.up = async knex => {
|
|
await knex.schema.createTable('vbox', table => {
|
|
table.timestamps();
|
|
table.uuid('id').primary();
|
|
table.uuid('account').notNullable()
|
|
table.uuid('game').notNullable()
|
|
table.binary('data').notNullable();
|
|
|
|
table.foreign('game')
|
|
.references('id')
|
|
.inTable('games')
|
|
.onDelete('CASCADE');
|
|
|
|
table.foreign('account')
|
|
.references('id')
|
|
.inTable('accounts')
|
|
.onDelete('CASCADE');
|
|
|
|
table.index('id');
|
|
table.index('account');
|
|
table.unique(['account', 'game']);
|
|
});
|
|
|
|
// not really sure if this is a good idea
|
|
await knex('games').insert({
|
|
id: NULL_UUID,
|
|
data: 'INVALID',
|
|
joinable: false,
|
|
});
|
|
|
|
return true;
|
|
};
|
|
|
|
exports.down = async () => {}; |