mikelax / forgingadventures

0 stars 0 forks source link

Implement Audit Trail History for Character Changes. #153

Closed nazar closed 6 years ago

nazar commented 6 years ago

entries should include: timestamp, user making change, field deltas, optional Game ID, maybe even Game Message.

nazar commented 6 years ago

Hey @mikelax - Some thoughts on the character audit trail feature plus how it will be used when creating and displaying game messages and character headers.

Table structures

tables

character_logs

Records any change to characters.character_details, starting from character creation. Additionally, a change_description column is added to record reasons (i.e. character born, HP loss from damage, etc...)

characters

We add a last_character_log_id column to hold the last recorded change. This is slightly denormalises the table relationship but it makes it quicker and easier to lookup the last character_logs entry for a given character_id

game_messages

This table is modified to record the character_log_id instead of the character_id. Each time a game_messages record is created, we use the character_log_id from characters.last_character_log_id

A pretty sequence diagram to illustrate logic

fa character logs

mikelax commented 6 years ago

hey @nazar great work. I think this is just about there, and totally makes sense. Here are a couple of small comments.