vbox init
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
exports.up = async knex => {
|
||||
return knex.schema.createTable('items', table => {
|
||||
table.uuid('id').primary();
|
||||
table.uuid('account').notNullable()
|
||||
table.foreign('account')
|
||||
.references('id')
|
||||
.inTable('accounts')
|
||||
.onDelete('CASCADE');
|
||||
table.binary('data').notNullable();
|
||||
table.index('id');
|
||||
table.index('account');
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = async () => {};
|
||||
@@ -0,0 +1,36 @@
|
||||
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 () => {};
|
||||
@@ -11,9 +11,6 @@
|
||||
"author": "",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"ascii-tree": "^0.3.0",
|
||||
"cli-ascii-tree": "0.0.4",
|
||||
"inquirer": "^6.2.0",
|
||||
"knex": "^0.15.2",
|
||||
"pg": "^7.4.3"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user