update seed for honinbo game
This commit is contained in:
parent
796bb7aad9
commit
55a282b5c8
2 changed files with 2381 additions and 312 deletions
|
@ -1,49 +1,72 @@
|
||||||
|
exports.seed = async function (knex) {
|
||||||
exports.seed = async function(knex) {
|
|
||||||
// Deletes ALL existing entries
|
// Deletes ALL existing entries
|
||||||
return await knex('game').del()
|
return await knex("game")
|
||||||
|
.del()
|
||||||
.then(async function () {
|
.then(async function () {
|
||||||
// Inserts seed entries
|
// Inserts seed entries
|
||||||
await knex('user')
|
await knex("user")
|
||||||
.select('id')
|
.select("id")
|
||||||
.orderBy('id')
|
.orderBy("id")
|
||||||
.whereIn('username', ['user-one', 'user-two'])
|
.whereIn("username", ["user-one", "user-two"])
|
||||||
.then(async ([userOne, userTwo]) => {
|
.then(async ([userOne, userTwo]) => {
|
||||||
const res = await knex('room')
|
const res = await knex("room")
|
||||||
.select('id')
|
.select("id")
|
||||||
.where({name: 'main'})
|
.where({ name: "main" })
|
||||||
.then(([room]) => {
|
.then(([room]) => {
|
||||||
console.log('inserting')
|
console.log("inserting");
|
||||||
return knex('game').insert(
|
return knex("game")
|
||||||
|
.insert(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
application: 'node-go', application_version: '0.1.0',
|
application: "node-go",
|
||||||
player_black: 'user-one', player_white: 'user-two',
|
application_version: "0.1.0",
|
||||||
player_black_rank: 'UR', player_white_rank: 'UR',
|
player_black: "user-one",
|
||||||
user_black: userOne.id, user_white: userTwo.id,
|
player_white: "user-two",
|
||||||
room: room.id, open: false
|
player_black_rank: "UR",
|
||||||
|
player_white_rank: "UR",
|
||||||
|
user_black: userOne.id,
|
||||||
|
user_white: userTwo.id,
|
||||||
|
room: room.id,
|
||||||
|
open: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
application: 'node-go', application_version: '0.1.0',
|
application: "node-go",
|
||||||
player_black: 'user-one', player_black_rank: 'UR',
|
application_version: "0.1.0",
|
||||||
|
player_black: "user-one",
|
||||||
|
player_black_rank: "UR",
|
||||||
user_black: userTwo.id,
|
user_black: userTwo.id,
|
||||||
room: room.id, open: true
|
room: room.id,
|
||||||
|
open: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
date: new Date('1971-05-06'),
|
date: new Date("1971-05-06"),
|
||||||
application: 'node-go', application_version: '0.1.0',
|
application: "node-go",
|
||||||
player_black: 'Ishida Yoshio', player_black_rank: 'D7',
|
application_version: "0.1.0",
|
||||||
player_white: 'Rin Kaiho', player_white_rank: 'D9',
|
player_black: "Ishida Yoshio",
|
||||||
room: room.id, open: true,
|
player_black_rank: "D7",
|
||||||
event: '', round: 2, win_type: 'B+', score: 1.5
|
player_white: "Rin Kaiho",
|
||||||
}
|
player_white_rank: "D9",
|
||||||
], ['*']
|
room: room.id,
|
||||||
|
open: false,
|
||||||
|
event: "",
|
||||||
|
round: 2,
|
||||||
|
win_type: "B+",
|
||||||
|
score: 1.5,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
["*"]
|
||||||
)
|
)
|
||||||
.then(res => res)
|
.then((res) => res)
|
||||||
.catch(e => {console.log('error'); console.log(e)})
|
.catch((e) => {
|
||||||
}).then(entries => {console.log({success: 'game', entries})})
|
console.log("error");
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then((entries) => {
|
||||||
|
console.log({ success: "game", entries });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
};
|
};
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue