Updating and Cascade Delete Implementation Question

  •  I have a db that stores tests,  a pool questions, and answers.  Each employee though taking the same test will get a different "version" since the questions are selected from a pool.  The questions he is asked and the answers he selects are saved to the db in the user tables. The responses.AnswerID refers back to the Answers table where employee answers can be check as right or wrong.

    Problem:

    If a question is updated, i have a least an updated column, however, the whole structure of the question may be changed, including the answer. Those who answered the question before it was changed may report getting the question wrong when in fact i was right before the change.

    The question may be totally different from the original question, being about a different subject than before.

    Cascade deletes could delete past employee testing info. However, if the questions are deleted without affecting the employee tests, then there will be nothing for the employee question ids to refer back to.

    So how do i modify the db without corrupting the data?

    The table schema can be found at http://www.geocities.com/jacobpressures/

    Thanks!

  • I would implement some method of invalidating the question so it is not used on future tests, and is still visible when viewing older tests. and questions are only added never deleted.

    a thing i commonly do is have an Active flag on a table.

    so when selecting questions for a new test you would not include questions where active = false.

    I would avoid deleting questions unless all the test that used the question are removed, and the question is no longer referenced.

     

    my $0.02

  • Thanks very much! I think that will work!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply