Skip to content

Commit

Permalink
Adds name and desc to achievement metadata (tgstation#48146)
Browse files Browse the repository at this point in the history
* Adds name and desc to achievement metadata

* Name 64, Desc 512
  • Loading branch information
AnturK authored and Jordie0608 committed Dec 10, 2019
1 parent 85228e0 commit 27ee01c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
15 changes: 12 additions & 3 deletions SQL/database_changelog.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
Any time you make a change to the schema files, remember to increment the database schema version. Generally increment the minor number, major should be reserved for significant changes to the schema. Both values go up to 255.

The latest database version is 5.4; The query to update the schema revision table is:
The latest database version is 5.6; The query to update the schema revision table is:

INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 5);
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 6);
or
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 5);
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 6);

In any query remember to add a prefix to the table names if you use one.


-----------------------------------------------------

Version 5.6, 6 December 2019 by Anturke
Added achievement_name and achievement_description columns to achievement_metadata table.


ALTER TABLE `achievement_metadata` ADD COLUMN (`achievement_name` VARCHAR(64) NULL DEFAULT NULL, `achievement_description` VARCHAR(512) NULL DEFAULT NULL);

-----------------------------------------------------

Version 5.5, 26 October 2019 by Anturke
Expand Down
2 changes: 2 additions & 0 deletions SQL/tgstation_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@ CREATE TABLE `achievement_metadata` (
`achievement_key` VARCHAR(32) NOT NULL,
`achievement_version` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`achievement_type` enum('achievement','score','award') NULL DEFAULT NULL,
`achievement_name` VARCHAR(64) NULL DEFAULT NULL,
`achievement_description` VARCHAR(512) NULL DEFAULT NULL,
PRIMARY KEY (`achievement_key`)
) ENGINE=InnoDB;

Expand Down
2 changes: 2 additions & 0 deletions SQL/tgstation_schema_prefixed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@ CREATE TABLE `SS13_achievement_metadata` (
`achievement_key` VARCHAR(32) NOT NULL,
`achievement_version` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
`achievement_type` enum('achievement','score','award') NULL DEFAULT NULL,
`achievement_name` VARCHAR(64) NULL DEFAULT NULL,
`achievement_description` VARCHAR(512) NULL DEFAULT NULL,
PRIMARY KEY (`achievement_key`)
) ENGINE=InnoDB;

Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* make sure you add an update to the schema_version stable in the db changelog
*/
#define DB_MINOR_VERSION 5
#define DB_MINOR_VERSION 6


//! ## Timing subsystem
Expand Down
4 changes: 2 additions & 2 deletions code/datums/achievements/_awards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
///What ID do we use in db, limited to 32 characters
var/database_id
//Bump this up if you're changing outdated table identifier and/or achievement type
var/achievement_version = 1
var/achievement_version = 2

//Value returned on db connection failure, in case we want to differ 0 and nonexistent later on
var/default_value = FALSE
Expand All @@ -30,7 +30,7 @@
return list("ckey" = "'[sanitizeSQL(key)]'","achievement_key" = "'[sanitizeSQL(database_id)]'", "value" = "'[sanitizeSQL(value)]'")

/datum/award/proc/get_metadata_row()
return list("achievement_key" = "'[sanitizeSQL(database_id)]'", "achievement_version" = "'[sanitizeSQL(achievement_version)]'", "achievement_type" = "'award'")
return list("achievement_key" = "'[sanitizeSQL(database_id)]'", "achievement_version" = "'[sanitizeSQL(achievement_version)]'", "achievement_type" = "'award'", "achievement_name" = "'[sanitizeSQL(name)]'", "achievement_description" = "'[sanitizeSQL(desc)]'")

///Get raw numerical achievement value from the database
/datum/award/proc/get_raw_value(key)
Expand Down

0 comments on commit 27ee01c

Please sign in to comment.