Rename database column SOURCE to ADDON_ID.

Also rename VERSION to ADDON_VERSION.
This commit is contained in:
Pentarctagon 2023-01-06 10:53:52 -06:00 committed by Pentarctagon
parent 18d1f235ca
commit fbeae32002
14 changed files with 29 additions and 29 deletions

View file

@ -325,12 +325,12 @@ void dbconn::insert_game_player_info(const std::string& uuid, int game_id, const
log_sql_exception("Failed to insert game player info row for UUID `"+uuid+"` and game ID `"+std::to_string(game_id)+"`", e);
}
}
unsigned long long dbconn::insert_game_content_info(const std::string& uuid, int game_id, const std::string& type, const std::string& name, const std::string& id, const std::string& source, const std::string& version)
unsigned long long dbconn::insert_game_content_info(const std::string& uuid, int game_id, const std::string& type, const std::string& name, const std::string& id, const std::string& addon_id, const std::string& addon_version)
{
try
{
return modify(connection_, "INSERT INTO `"+db_game_content_info_table_+"`(INSTANCE_UUID, GAME_ID, TYPE, NAME, ID, SOURCE, VERSION) VALUES(?, ?, ?, ?, ?, ?, ?)",
uuid, game_id, type, name, id, source, version);
return modify(connection_, "INSERT INTO `"+db_game_content_info_table_+"`(INSTANCE_UUID, GAME_ID, TYPE, NAME, ID, ADDON_ID, ADDON_VERSION) VALUES(?, ?, ?, ?, ?, ?, ?)",
uuid, game_id, type, name, id, addon_id, addon_version);
}
catch(const mariadb::exception::base& e)
{

View file

@ -137,7 +137,7 @@ class dbconn
/**
* @see forum_user_handler::db_insert_game_content_info().
*/
unsigned long long insert_game_content_info(const std::string& uuid, int game_id, const std::string& type, const std::string& name, const std::string& id, const std::string& source, const std::string& version);
unsigned long long insert_game_content_info(const std::string& uuid, int game_id, const std::string& type, const std::string& name, const std::string& id, const std::string& addon_id, const std::string& addon_version);
/**
* @see forum_user_handler::db_set_oos_flag().

View file

@ -227,8 +227,8 @@ void fuh::db_insert_game_player_info(const std::string& uuid, int game_id, const
conn_.insert_game_player_info(uuid, game_id, username, side_number, is_host, faction, version, source, current_user);
}
unsigned long long fuh::db_insert_game_content_info(const std::string& uuid, int game_id, const std::string& type, const std::string& name, const std::string& id, const std::string& source, const std::string& version){
return conn_.insert_game_content_info(uuid, game_id, type, name, id, source, version);
unsigned long long fuh::db_insert_game_content_info(const std::string& uuid, int game_id, const std::string& type, const std::string& name, const std::string& id, const std::string& addon_id, const std::string& addon_version){
return conn_.insert_game_content_info(uuid, game_id, type, name, id, addon_id, addon_version);
}
void fuh::db_set_oos_flag(const std::string& uuid, int game_id){

View file

@ -178,11 +178,11 @@ public:
* @param type The add-on content's type (ie: era, scenario, etc).
* @param name The name of the content.
* @param id The id of the content.
* @param source The source add-on for the content.
* @param version The version of the source add-on.
* @param addon_id The id of the addon that the content is from.
* @param addon_version The version of the add-on.
* @return The number of rows inserted which should always be 1.
*/
unsigned long long db_insert_game_content_info(const std::string& uuid, int game_id, const std::string& type, const std::string& name, const std::string& id, const std::string& source, const std::string& version);
unsigned long long db_insert_game_content_info(const std::string& uuid, int game_id, const std::string& type, const std::string& name, const std::string& id, const std::string& addon_id, const std::string& addon_version);
/**
* Sets the OOS flag in the database if wesnothd is told by a client it has detected an OOS error.

View file

@ -143,7 +143,7 @@ public:
virtual void db_insert_game_info(const std::string& uuid, int game_id, const std::string& version, const std::string& name, int reload, int observers, int is_public, int has_password) = 0;
virtual void db_update_game_end(const std::string& uuid, int game_id, const std::string& replay_location) = 0;
virtual void db_insert_game_player_info(const std::string& uuid, int game_id, const std::string& username, int side_number, int is_host, const std::string& faction, const std::string& version, const std::string& source, const std::string& current_user) = 0;
virtual unsigned long long db_insert_game_content_info(const std::string& uuid, int game_id, const std::string& type, const std::string& name, const std::string& id, const std::string& source, const std::string& version) = 0;
virtual unsigned long long db_insert_game_content_info(const std::string& uuid, int game_id, const std::string& type, const std::string& name, const std::string& id, const std::string& addon_id, const std::string& addon_version) = 0;
virtual void db_set_oos_flag(const std::string& uuid, int game_id) = 0;
virtual void async_test_query(boost::asio::io_service& io_service, int limit) = 0;
virtual bool db_topic_id_exists(int topic_id) = 0;

View file

@ -1,4 +1,4 @@
select content.ID as ERA, content.SOURCE as ADDON, content.VERSION, count(*) as ERA_COUNT
select content.ID as ERA, content.ADDON_ID as ADDON, content.ADDON_VERSION, count(*) as ERA_COUNT
from wesnothd_game_info game, wesnothd_game_content_info content
where YEAR(game.START_TIME) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
and MONTH(game.START_TIME) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)
@ -7,5 +7,5 @@ where YEAR(game.START_TIME) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
and game.INSTANCE_UUID = content.INSTANCE_UUID
and game.GAME_ID = content.GAME_ID
and content.TYPE = 'era'
group by content.ID, content.SOURCE, content.VERSION
group by content.ID, content.ADDON_ID, content.ADDON_VERSION
order by count(*) desc

View file

@ -1,4 +1,4 @@
select content.ID as MAP, content.SOURCE as ADDON, content.VERSION, count(*) as MAP_COUNT
select content.ID as MAP, content.ADDON_ID as ADDON, content.ADDON_VERSION, count(*) as MAP_COUNT
from wesnothd_game_info game, wesnothd_game_content_info content
where YEAR(game.START_TIME) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
and MONTH(game.START_TIME) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)
@ -7,5 +7,5 @@ where YEAR(game.START_TIME) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
and game.INSTANCE_UUID = content.INSTANCE_UUID
and game.GAME_ID = content.GAME_ID
and content.TYPE = 'scenario'
group by content.ID, content.SOURCE, content.VERSION
group by content.ID, content.ADDON_ID, content.ADDON_VERSION
order by count(*) desc

View file

@ -1,4 +1,4 @@
select IFNULL(content.ID,'No Modifications') as MODIFICATION, IFNULL(content.SOURCE,'') as ADDON, IFNULL(content.VERSION,'') as VERSION, count(*) as MODIFICATION_COUNT
select IFNULL(content.ID,'No Modifications') as MODIFICATION, IFNULL(content.ADDON_ID,'') as ADDON, IFNULL(content.ADDON_VERSION,'') as VERSION, count(*) as MODIFICATION_COUNT
from wesnothd_game_info game
left join wesnothd_game_content_info content
on game.INSTANCE_UUID = content.INSTANCE_UUID
@ -8,5 +8,5 @@ where YEAR(game.START_TIME) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
and MONTH(game.START_TIME) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)
and game.END_TIME is not NULL
and TIMESTAMPDIFF(MINUTE, game.START_TIME, game.END_TIME) > 5
group by content.ID, content.SOURCE, content.VERSION
group by content.ID, content.ADDON_ID, content.ADDON_VERSION
order by count(*) desc

View file

@ -1,4 +1,4 @@
select content.ID as ERA, content.SOURCE as ADDON, content.VERSION, count(*) as OOS_COUNT
select content.ID as ERA, content.ADDON_ID as ADDON, content.ADDON_VERSION, count(*) as OOS_COUNT
from wesnothd_game_info game, wesnothd_game_content_info content
where YEAR(game.START_TIME) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
and MONTH(game.START_TIME) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)
@ -8,5 +8,5 @@ where YEAR(game.START_TIME) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
and game.INSTANCE_UUID = content.INSTANCE_UUID
and game.GAME_ID = content.GAME_ID
and content.TYPE = 'era'
group by content.ID, content.SOURCE, content.VERSION
group by content.ID, content.ADDON_ID, content.ADDON_VERSION
order by count(*) desc

View file

@ -1,4 +1,4 @@
select content.ID as MAP, content.SOURCE as ADDON, content.VERSION, count(*) as OOS_COUNT
select content.ID as MAP, content.ADDON_ID as ADDON, content.ADDON_VERSION, count(*) as OOS_COUNT
from wesnothd_game_info game, wesnothd_game_content_info content
where YEAR(game.START_TIME) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
and MONTH(game.START_TIME) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)
@ -8,5 +8,5 @@ where YEAR(game.START_TIME) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
and game.INSTANCE_UUID = content.INSTANCE_UUID
and game.GAME_ID = content.GAME_ID
and content.TYPE = 'scenario'
group by content.ID, content.SOURCE, content.VERSION
group by content.ID, content.ADDON_ID, content.ADDON_VERSION
order by count(*) desc

View file

@ -1,4 +1,4 @@
select content.ID as MODIFICATION, content.SOURCE as ADDON, content.VERSION, count(*) as OOS_COUNT
select content.ID as MODIFICATION, content.ADDON_ID as ADDON, content.ADDON_VERSION, count(*) as OOS_COUNT
from wesnothd_game_info game, wesnothd_game_content_info content
where game.INSTANCE_UUID = content.INSTANCE_UUID
and game.GAME_ID = content.GAME_ID
@ -8,5 +8,5 @@ where game.INSTANCE_UUID = content.INSTANCE_UUID
and MONTH(game.START_TIME) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)
and game.END_TIME is not NULL
and TIMESTAMPDIFF(MINUTE, game.START_TIME, game.END_TIME) > 5
group by content.ID, content.SOURCE, content.VERSION
group by content.ID, content.ADDON_ID, content.ADDON_VERSION
order by count(*) desc

View file

@ -1,4 +1,4 @@
select count(*) as OOS_COUNT, eras.ID as ERA, eras.SOURCE as ERA_ADDON, eras.VERSION as ERA_VERSION, scenarios.ID as MAP, scenarios.SOURCE as MAP_ADDON, scenarios.VERSION as MAP_VERSION, IFNULL(GROUP_CONCAT(distinct concat(mods.ID,'(',mods.SOURCE,':',mods.VERSION,')') SEPARATOR '|'), 'No Modifications') AS MODIFICATIONS
select count(*) as OOS_COUNT, eras.ID as ERA, eras.ADDON_ID as ERA_ADDON, eras.ADDON_VERSION as ERA_VERSION, scenarios.ID as MAP, scenarios.ADDON_ID as MAP_ADDON, scenarios.ADDON_VERSION as MAP_VERSION, IFNULL(GROUP_CONCAT(distinct concat(mods.ID,'(',mods.ADDON_ID,':',mods.ADDON_VERSION,')') SEPARATOR '|'), 'No Modifications') AS MODIFICATIONS
from wesnothd_game_info game
inner join wesnothd_game_content_info scenarios
on game.INSTANCE_UUID = scenarios.INSTANCE_UUID
@ -17,5 +17,5 @@ where game.OOS = 1
and MONTH(game.START_TIME) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)
and game.END_TIME is not NULL
and TIMESTAMPDIFF(MINUTE, game.START_TIME, game.END_TIME) > 5
group by eras.ID, eras.SOURCE, eras.VERSION, scenarios.ID, scenarios.SOURCE, scenarios.VERSION
group by eras.ID, eras.ADDON_ID, eras.ADDON_VERSION, scenarios.ID, scenarios.ADDON_ID, scenarios.ADDON_VERSION
order by count(*) desc, eras.ID, scenarios.ID, mods.ID

View file

@ -1,4 +1,4 @@
select eras.ID as ERA, eras.SOURCE as ERA_ADDON, eras.VERSION as ERA_VERSION, scenarios.ID as MAP, scenarios.SOURCE as MAP_ADDON, scenarios.VERSION as MAP_VERSION, IFNULL(GROUP_CONCAT(distinct concat(mods.ID,'(',mods.SOURCE,':',mods.VERSION,')') SEPARATOR '|'), 'No Modifications') AS MODIFICATIONS, concat('https://replays.wesnoth.org/', substring(game.INSTANCE_VERSION, 1, 4), '/', year(game.END_TIME), '/', lpad(month(game.END_TIME), 2, '0'), '/', lpad(day(game.END_TIME), 2, '0'), '/', game.REPLAY_NAME) AS REPLAY_LOCATION
select eras.ID as ERA, eras.ADDON_ID as ERA_ADDON, eras.ADDON_VERSION as ERA_VERSION, scenarios.ID as MAP, scenarios.ADDON_ID as MAP_ADDON, scenarios.ADDON_VERSION as MAP_VERSION, IFNULL(GROUP_CONCAT(distinct concat(mods.ID,'(',mods.ADDON_ID,':',mods.ADDON_VERSION,')') SEPARATOR '|'), 'No Modifications') AS MODIFICATIONS, concat('https://replays.wesnoth.org/', substring(game.INSTANCE_VERSION, 1, 4), '/', year(game.END_TIME), '/', lpad(month(game.END_TIME), 2, '0'), '/', lpad(day(game.END_TIME), 2, '0'), '/', game.REPLAY_NAME) AS REPLAY_LOCATION
from wesnothd_game_info game
inner join wesnothd_game_content_info scenarios
on game.INSTANCE_UUID = scenarios.INSTANCE_UUID

View file

@ -111,8 +111,8 @@ CREATE INDEX USER_ID_IDX ON game_player_info(USER_ID);
-- TYPE: one of era/scenario/modification/campaign
-- ID: the id of the content
-- NAME: the content's user-visible name
-- SOURCE: the id of the add-on that the particular content came from
-- VERSION: the version of the source add-on
-- ADDON_ID: the id of the add-on that the particular content came from
-- ADDON_VERSION: the version of the add-on
create table game_content_info
(
INSTANCE_UUID CHAR(36) NOT NULL,
@ -120,8 +120,8 @@ create table game_content_info
TYPE VARCHAR(100) NOT NULL,
ID VARCHAR(100) NOT NULL,
NAME VARCHAR(255),
SOURCE VARCHAR(100) NOT NULL,
VERSION VARCHAR(255) NOT NULL,
ADDON_ID VARCHAR(100) NOT NULL,
ADDON_VERSION VARCHAR(255) NOT NULL,
PRIMARY KEY (INSTANCE_UUID, GAME_ID, TYPE, ID, SOURCE)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;