What to do if the user wants to make a destructive change?
vr2262 opened this issue · 5 comments
At the moment, if a question is deleted from a survey, any answers to that question will be deleted as well. If a survey is deleted, all submissions to that survey will be deleted. Wacky things can happen if the user modifies a question.
What should we do in these scenarios? We could...
- Do nothing. The user should be aware of potentially destructive actions.
- Warn the user. Before the user makes any destructive change, display a warning and offer to export any data that would be affected.
- Avoid deleting things. Instead of actually doing anything destructive, any modification results in an entirely new survey.
My vote is for number 3.
- May be buggy and hard to handle having two submissions with different schemas.
- Basically the same as number 3 (if we delete submissions that have the old schema)
Updating existing submissions with an older schema isn't an exact science and probably not worth the trouble.
For what it's worth, here are the various scenarios and what the application does now (i.e., option 1).
Action | Consequence |
---|---|
Delete survey | All submissions to that survey get deleted as well |
Delete a question | Answers to that question get deleted |
Change the type_constraint_name of a question |
Existing answers will still be there in the database, but the application won't display them (this could be changed, in principle) |
Delete a choice from a multiple choice question | Any answers that selected that choice will be deleted |
Add a new question, choice, or branch | Nothing bad happens |
Rearrange existing questions, choices, or branches | Nothing bad happens |
I vote for 3 as well, largely b/c it's consistent with the idea of immutable data databases, e.g. Datomic
I have made the proposed change (option 3) in the non_destructive_update branch. Here is the new consequence table:
Action | Consequence |
---|---|
Delete survey | All submissions to that survey get deleted as well. |
Update survey | The existing survey will be renamed to end with "(new version created on <ISO time>) ". A new survey will be created, and any submissions that can sensibly be copied over will be. |
Delete a question in an update | Answers to that question will not appear in the updated version. |
Change the type_constraint_name of a question |
Existing answers will not be copied over to the new version, with the exception of multiple_choice ↔ multiple_choice_with_other , which will preserve answers corresponding to surviving choices. |
Delete a choice from a multiple choice question | Any answers that selected that choice will not be copied over. |
Add a new question, choice, or branch | Nothing bad happens. This counts as an update, so it creates a new survey with copied-over submissions. |
Rearrange existing questions, choices, or branches | Nothing bad happens. This counts as an update, so it creates a new survey with copied-over submissions. |