Skip to content

Commit

Permalink
Change projectile_deaths.damage column type from int to float
Browse files Browse the repository at this point in the history
  • Loading branch information
Tripperful committed Mar 1, 2024
1 parent f3dd987 commit b0b54b2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/server/src/db/stats/stats.functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ OR REPLACE PROCEDURE projectile_death (death_data json) AS $$ BEGIN
death_data->>'entityKiller',
(death_data->>'entityIdKiller')::bigint,
(death_data->>'killerId')::bigint,
(death_data->>'damage')::int,
(death_data->>'damage')::float,
(death_data->>'damageType')::int,
(death_data->>'ammoType')::int,
(death_data->>'lifetime')::float,
Expand Down
12 changes: 12 additions & 0 deletions packages/server/src/db/stats/stats.migrations.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Change the type of the damage column in the
-- projectile_deaths table from int to float
DO $$ BEGIN
IF (SELECT pg_typeof(damage)
FROM projectile_deaths
LIMIT 1) = pg_typeof(1::int) THEN
ALTER TABLE projectile_deaths
ALTER COLUMN damage
TYPE float;
END IF;
END;
$$ LANGUAGE plpgsql;
2 changes: 1 addition & 1 deletion packages/server/src/db/stats/stats.tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ CREATE TABLE IF NOT EXISTS
killer_entity text,
killer_entity_id bigint,
killer_steam_id bigint,
damage int,
damage float,
damage_type int,
ammo_type int,
lifetime float,
Expand Down

0 comments on commit b0b54b2

Please sign in to comment.