add category enu

This commit is contained in:
Kalle (Sendou)
2020-09-06 20:13:32 +03:00
parent a10279b83e
commit 0102c1b22d
2 changed files with 38 additions and 10 deletions

View File

@@ -10,7 +10,6 @@ const cors = require("cors")
const passport = require("passport")
const DiscordStrategy = require("passport-discord").Strategy
const User = require("./mongoose-models/user")
const Player = require("./mongoose-models/player")
const path = require("path")
const schema = require("./schema")
const mockUser = require("./utils/mocks")
@@ -52,15 +51,16 @@ passport.use(
}
}
console.log("userToSave", userToSave)
User.updateOne(
{ discord_id: userToSave.discord_id },
userToSave,
{ upsert: true },
function (err, user) {
return cb(err, userToSave)
}
)
Promise.all([
User.updateOne(
{ discord_id: userToSave.discord_id },
userToSave,
{ upsert: true },
function (err, user) {
return cb(err, userToSave)
}
),
])
}
)
)

View File

@@ -3,8 +3,35 @@ import * as Knex from "knex"
export async function up(knex: Knex): Promise<void> {
return knex.schema.createTable("salmonRunRecords", function (table) {
table.increments()
table.boolean("approved").notNullable()
table.integer("goldenEggCount").notNullable()
table.enu("wildcards", ["1_WILDCARD", "4_WILCARDS", "4_GOLDEN_WILDCARDS"])
table
.enu("category", [
"TOTAL",
"TOTAL_NO_NIGHT",
"PRINCESS",
"NT_NORMAL",
"HT_NORMAL",
"LT_NORMAL",
"NT_RUSH",
"HT_RUSH",
"LT_RUSH",
"NT_FOG",
"HT_FOG",
"LT_FOG",
"NT_GOLDIE",
"HT_GOLDIE",
"LT_GOLDIE",
"NT_GRILLERS",
"HT_GRILLERS",
"LT_GRILLERS",
"NT_MOTHERSHIP",
"HT_MOTHERSHIP",
"LT_MOTHERSHIP",
"LT_COHOCK",
])
.notNullable()
table
.integer("stageId")
.notNullable()
@@ -12,6 +39,7 @@ export async function up(knex: Knex): Promise<void> {
.inTable("salmonRunStages")
table.integer("grizzcoWeaponId").references("id").inTable("weapons")
table.specificType("links", "TEXT[]")
table.timestamp("createdAt").defaultTo(knex.fn.now())
})
}