Patch weapon mods

This commit is contained in:
2023-04-24 21:15:21 +02:00
parent d3dcf508c2
commit 5dcc108287
2 changed files with 48 additions and 0 deletions
@@ -0,0 +1,42 @@
import { Kysely, sql } from 'kysely'
import { Client } from 'pg'
const pgClient = new Client({
host: process.env.POSTGRES_HOST,
database: process.env.POSTGRES_DATABASE,
user: process.env.POSTGRES_USER,
password: process.env.POSTGRES_PASSWORD
})
export async function up(db: Kysely<any>): Promise<void> {
await pgClient.connect()
await pgClient.query(
`ALTER TABLE kill RENAME attacker_offhand_weapon_3 TO victim_offhand_weapon_3_mods;`
)
await pgClient.query(
`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_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_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
await pgClient.end()
}
export async function down(db: Kysely<any>): Promise<void> { }
+6
View File
@@ -107,13 +107,19 @@ 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',
'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',
'cause_of_death', 'cause_of_death',
'victim_titan', 'victim_titan',
'attacker_titan' 'attacker_titan'