fix 2 for offhand weapon
This commit is contained in:
@@ -10,33 +10,31 @@ const pgClient = new Client({
|
|||||||
|
|
||||||
export async function up(db: Kysely<any>): Promise<void> {
|
export async function up(db: Kysely<any>): Promise<void> {
|
||||||
await pgClient.connect()
|
await pgClient.connect()
|
||||||
await pgClient.query(
|
await pgClient.query(`ALTER TABLE kill RENAME attacker_offhand_weapon_2 TO victim_offhand_weapon_2_mods;`)
|
||||||
`ALTER TABLE kill RENAME attacker_offhand_weapon_3 TO victim_offhand_weapon_3_mods;`
|
await pgClient.query(`ALTER TABLE kill RENAME attacker_offhand_weapon_1 TO victim_offhand_weapon_1_mods;`)
|
||||||
)
|
await pgClient.query(`ALTER TABLE kill RENAME victim_offhand_weapon_2 TO victim_offhand_weapon_2_mods;`)
|
||||||
await pgClient.query(
|
await pgClient.query(`ALTER TABLE kill RENAME victim_offhand_weapon_1 TO victim_offhand_weapon_1_mods;`)
|
||||||
`ALTER TABLE kill RENAME attacker_offhand_weapon_2 TO victim_offhand_weapon_2_mods;`
|
|
||||||
)
|
|
||||||
await pgClient.query(
|
|
||||||
`ALTER TABLE kill RENAME attacker_offhand_weapon_1 TO victim_offhand_weapon_1_mods;`
|
|
||||||
)
|
|
||||||
await pgClient.query(
|
|
||||||
`ALTER TABLE kill RENAME victim_offhand_weapon_3 TO victim_offhand_weapon_3_mods;`
|
|
||||||
)
|
|
||||||
await pgClient.query(
|
|
||||||
`ALTER TABLE kill RENAME victim_offhand_weapon_2 TO victim_offhand_weapon_2_mods;`
|
|
||||||
)
|
|
||||||
await pgClient.query(
|
|
||||||
`ALTER TABLE kill RENAME victim_offhand_weapon_1 TO victim_offhand_weapon_1_mods;`
|
|
||||||
)
|
|
||||||
|
|
||||||
await pgClient.query(`ALTER TABLE kill ADD COLUMN IF NOT EXISTS victim_offhand_weapon_1 character varying NULL;`)
|
await pgClient.query(`ALTER TABLE kill ADD COLUMN IF NOT EXISTS victim_offhand_weapon_1 character varying NULL;`)
|
||||||
await pgClient.query(`ALTER TABLE kill ADD COLUMN IF NOT EXISTS victim_offhand_weapon_2 character varying NULL;`)
|
await pgClient.query(`ALTER TABLE kill ADD COLUMN IF NOT EXISTS victim_offhand_weapon_2 character varying NULL;`)
|
||||||
await pgClient.query(`ALTER TABLE kill ADD COLUMN IF NOT EXISTS victim_offhand_weapon_3 character varying NULL;`)
|
|
||||||
await pgClient.query(`ALTER TABLE kill ADD COLUMN IF NOT EXISTS attacker_offhand_weapon_1 character varying NULL;`)
|
await pgClient.query(`ALTER TABLE kill ADD COLUMN IF NOT EXISTS attacker_offhand_weapon_1 character varying NULL;`)
|
||||||
await pgClient.query(`ALTER TABLE kill ADD COLUMN IF NOT EXISTS attacker_offhand_weapon_2 character varying NULL;`)
|
await pgClient.query(`ALTER TABLE kill ADD COLUMN IF NOT EXISTS attacker_offhand_weapon_2 character varying NULL;`)
|
||||||
await pgClient.query(`ALTER TABLE kill ADD COLUMN IF NOT EXISTS attacker_offhand_weapon_3 character varying NULL;`)
|
|
||||||
//Update the hosts column once the hoster table is manually updated
|
//Update the hosts column once the hoster table is manually updated
|
||||||
await pgClient.end()
|
await pgClient.end()
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down(db: Kysely<any>): Promise<void> { }
|
export async function down(db: Kysely<any>): Promise<void> {
|
||||||
|
await pgClient.connect()
|
||||||
|
|
||||||
|
await pgClient.query(`ALTER TABLE kill DROP COLUMN IF EXISTS victim_offhand_weapon_1;`)
|
||||||
|
await pgClient.query(`ALTER TABLE kill DROP COLUMN IF EXISTS victim_offhand_weapon_2;`)
|
||||||
|
await pgClient.query(`ALTER TABLE kill DROP COLUMN IF EXISTS attacker_offhand_weapon_1;`)
|
||||||
|
await pgClient.query(`ALTER TABLE kill DROP COLUMN IF EXISTS attacker_offhand_weapon_2;`)
|
||||||
|
|
||||||
|
await pgClient.query(`ALTER TABLE kill RENAME attacker_offhand_weapon_2_mods TO victim_offhand_weapon_2;`)
|
||||||
|
await pgClient.query(`ALTER TABLE kill RENAME attacker_offhand_weapon_1_mods TO victim_offhand_weapon_1;`)
|
||||||
|
await pgClient.query(`ALTER TABLE kill RENAME victim_offhand_weapon_2_mods TO victim_offhand_weapon_2;`)
|
||||||
|
await pgClient.query(`ALTER TABLE kill RENAME victim_offhand_weapon_1_mods TO victim_offhand_weapon_1;`)
|
||||||
|
|
||||||
|
await pgClient.end()
|
||||||
|
}
|
||||||
|
|||||||
+8
-4
@@ -21,8 +21,10 @@ export interface KillTable {
|
|||||||
attacker_weapon_2_mods: number
|
attacker_weapon_2_mods: number
|
||||||
attacker_weapon_3: string
|
attacker_weapon_3: string
|
||||||
attacker_weapon_3_mods: number
|
attacker_weapon_3_mods: number
|
||||||
attacker_offhand_weapon_1: number
|
attacker_offhand_weapon_1: string
|
||||||
attacker_offhand_weapon_2: number
|
attacker_offhand_weapon_1_mods: number
|
||||||
|
attacker_offhand_weapon_2: string
|
||||||
|
attacker_offhand_weapon_2_mods: number
|
||||||
victim_name: string
|
victim_name: string
|
||||||
victim_id: string
|
victim_id: string
|
||||||
victim_current_weapon: string
|
victim_current_weapon: string
|
||||||
@@ -33,8 +35,10 @@ export interface KillTable {
|
|||||||
victim_weapon_2_mods: number
|
victim_weapon_2_mods: number
|
||||||
victim_weapon_3: string
|
victim_weapon_3: string
|
||||||
victim_weapon_3_mods: string
|
victim_weapon_3_mods: string
|
||||||
victim_offhand_weapon_1: number
|
victim_offhand_weapon_1: string
|
||||||
victim_offhand_weapon_2: number
|
victim_offhand_weapon_1_mods: number
|
||||||
|
victim_offhand_weapon_2: string
|
||||||
|
victim_offhand_weapon_2_mods: number
|
||||||
cause_of_death: string
|
cause_of_death: string
|
||||||
distance: number
|
distance: number
|
||||||
titan?: string
|
titan?: string
|
||||||
|
|||||||
+20
-14
@@ -56,14 +56,14 @@ router.post(
|
|||||||
'attacker_weapon_1_mods',
|
'attacker_weapon_1_mods',
|
||||||
'attacker_weapon_2_mods',
|
'attacker_weapon_2_mods',
|
||||||
'attacker_weapon_3_mods',
|
'attacker_weapon_3_mods',
|
||||||
'attacker_offhand_weapon_1',
|
'attacker_offhand_weapon_1_mods',
|
||||||
'attacker_offhand_weapon_2',
|
'attacker_offhand_weapon_2_mods',
|
||||||
'victim_current_weapon_mods',
|
'victim_current_weapon_mods',
|
||||||
'victim_weapon_1_mods',
|
'victim_weapon_1_mods',
|
||||||
'victim_weapon_2_mods',
|
'victim_weapon_2_mods',
|
||||||
'victim_weapon_3_mods',
|
'victim_weapon_3_mods',
|
||||||
'victim_offhand_weapon_1',
|
'victim_offhand_weapon_1_mods',
|
||||||
'victim_offhand_weapon_2'
|
'victim_offhand_weapon_2_mods'
|
||||||
]).customSanitizer((value) => {
|
]).customSanitizer((value) => {
|
||||||
if (isNaN(value) || !value) {
|
if (isNaN(value) || !value) {
|
||||||
value = 0
|
value = 0
|
||||||
@@ -75,14 +75,14 @@ router.post(
|
|||||||
'attacker_weapon_1_mods',
|
'attacker_weapon_1_mods',
|
||||||
'attacker_weapon_2_mods',
|
'attacker_weapon_2_mods',
|
||||||
'attacker_weapon_3_mods',
|
'attacker_weapon_3_mods',
|
||||||
'attacker_offhand_weapon_1',
|
'attacker_offhand_weapon_1_mods',
|
||||||
'attacker_offhand_weapon_2',
|
'attacker_offhand_weapon_2_mods',
|
||||||
'victim_current_weapon_mods',
|
'victim_current_weapon_mods',
|
||||||
'victim_weapon_1_mods',
|
'victim_weapon_1_mods',
|
||||||
'victim_weapon_2_mods',
|
'victim_weapon_2_mods',
|
||||||
'victim_weapon_3_mods',
|
'victim_weapon_3_mods',
|
||||||
'victim_offhand_weapon_1',
|
'victim_offhand_weapon_1_mods',
|
||||||
'victim_offhand_weapon_2'
|
'victim_offhand_weapon_2_mods'
|
||||||
])
|
])
|
||||||
.toInt()
|
.toInt()
|
||||||
.isInt()
|
.isInt()
|
||||||
@@ -107,19 +107,17 @@ router.post(
|
|||||||
'attacker_name',
|
'attacker_name',
|
||||||
'attacker_current_weapon',
|
'attacker_current_weapon',
|
||||||
'attacker_weapon_1',
|
'attacker_weapon_1',
|
||||||
'attacker_weapon_1_mods',
|
|
||||||
'attacker_weapon_2',
|
'attacker_weapon_2',
|
||||||
'attacker_weapon_2_mods',
|
|
||||||
'attacker_weapon_3',
|
'attacker_weapon_3',
|
||||||
'attacker_weapon_3_mods',
|
'attacker_offhand_weapon_1',
|
||||||
|
'attacker_offhand_weapon_2',
|
||||||
'victim_name',
|
'victim_name',
|
||||||
'victim_current_weapon',
|
'victim_current_weapon',
|
||||||
'victim_weapon_1',
|
'victim_weapon_1',
|
||||||
'victim_weapon_1_mods',
|
|
||||||
'victim_weapon_2',
|
'victim_weapon_2',
|
||||||
'victim_weapon_2_mods',
|
|
||||||
'victim_weapon_3',
|
'victim_weapon_3',
|
||||||
'victim_weapon_3_mods',
|
'victim_offhand_weapon_1',
|
||||||
|
'victim_offhand_weapon_2',
|
||||||
'cause_of_death',
|
'cause_of_death',
|
||||||
'victim_titan',
|
'victim_titan',
|
||||||
'attacker_titan'
|
'attacker_titan'
|
||||||
@@ -161,7 +159,9 @@ router.post(
|
|||||||
attacker_weapon_3,
|
attacker_weapon_3,
|
||||||
attacker_weapon_3_mods,
|
attacker_weapon_3_mods,
|
||||||
attacker_offhand_weapon_1,
|
attacker_offhand_weapon_1,
|
||||||
|
attacker_offhand_weapon_1_mods,
|
||||||
attacker_offhand_weapon_2,
|
attacker_offhand_weapon_2,
|
||||||
|
attacker_offhand_weapon_2_mods,
|
||||||
victim_name,
|
victim_name,
|
||||||
victim_id,
|
victim_id,
|
||||||
victim_current_weapon,
|
victim_current_weapon,
|
||||||
@@ -173,7 +173,9 @@ router.post(
|
|||||||
victim_weapon_3,
|
victim_weapon_3,
|
||||||
victim_weapon_3_mods,
|
victim_weapon_3_mods,
|
||||||
victim_offhand_weapon_1,
|
victim_offhand_weapon_1,
|
||||||
|
victim_offhand_weapon_1_mods,
|
||||||
victim_offhand_weapon_2,
|
victim_offhand_weapon_2,
|
||||||
|
victim_offhand_weapon_2_mods,
|
||||||
cause_of_death,
|
cause_of_death,
|
||||||
distance
|
distance
|
||||||
} = req.body
|
} = req.body
|
||||||
@@ -197,7 +199,9 @@ router.post(
|
|||||||
attacker_weapon_3,
|
attacker_weapon_3,
|
||||||
attacker_weapon_3_mods,
|
attacker_weapon_3_mods,
|
||||||
attacker_offhand_weapon_1,
|
attacker_offhand_weapon_1,
|
||||||
|
attacker_offhand_weapon_1_mods,
|
||||||
attacker_offhand_weapon_2,
|
attacker_offhand_weapon_2,
|
||||||
|
attacker_offhand_weapon_2_mods,
|
||||||
victim_name,
|
victim_name,
|
||||||
victim_id,
|
victim_id,
|
||||||
victim_current_weapon,
|
victim_current_weapon,
|
||||||
@@ -209,7 +213,9 @@ router.post(
|
|||||||
victim_weapon_3,
|
victim_weapon_3,
|
||||||
victim_weapon_3_mods,
|
victim_weapon_3_mods,
|
||||||
victim_offhand_weapon_1,
|
victim_offhand_weapon_1,
|
||||||
|
victim_offhand_weapon_1_mods,
|
||||||
victim_offhand_weapon_2,
|
victim_offhand_weapon_2,
|
||||||
|
victim_offhand_weapon_2_mods,
|
||||||
cause_of_death,
|
cause_of_death,
|
||||||
distance
|
distance
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user