vbox init

This commit is contained in:
ntr
2019-02-16 17:45:28 +11:00
parent 8f12075d52
commit d0525a56bd
11 changed files with 241 additions and 40 deletions
-15
View File
@@ -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 () => {};
+36
View File
@@ -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 () => {};
-3
View File
@@ -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"
}