crazedsanity / cs-battletrack

PHP-Based web application for tracking data in traditional paper-and-pencil role playing games.
http://www.crazedsanity.com/projects/cs-battletrack
Other
1 stars 1 forks source link

Generic Saves Table #39

Closed crazedsanity closed 10 years ago

crazedsanity commented 10 years ago

Create a table that lists all possible saves (e.g. csbt_save_table), so it can be used when looking up saves from csbt_character_save_table. As of v0.8.2, the save_name is a free-text input field.

This change would require a schema change. Something like:

CREATE TABLE csbt_save_table (
   save_id serial NOT NULL PRIMARY KEY,
   save_name text NOT NULL UNIQUE
);

ALTER TABLE csbt_character_save_table ADD COLUMN save_id integer;
ALTER TABLE csbt_character_save_table ADD CONSTRAINT csbt_character_save_table_save_id_fkey FOREIGN KEY (save_id) REFERENCES csbt_save_table (save_id);
INSERT INTO csbt_save_table (save_name)
    SELECT distinct(save_name) FROM csbt_character_save_table;
ALTER TABLE csbt_character_save_table DROP COLUMN save_name;
crazedsanity commented 10 years ago

After further consideration, it seems like the association of ability to save should go on this new table (csbt_ability_table) instead of remaining on the character's save record.