-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to deal with deletions? #7
Comments
@Danwhy this is one of the difficult things that is actually quite easy. To make this work we need to have an anonymisation step in user registration. Go ahead with your intuition on how to set a record to "deleted" and we will fill-in the gaps shortly! |
In terms of the deleting associations, there are two ways we could go about it. The first is to simply do what we are already doing, which is updating the associations when we update the records, but to add a step where we filter out those associations that no longer exist. The second is to add a 'deleted' column to the composite table, and every time an update happens, check if any data has been updated, or just the association, and then performing the relevant update. This would be a little more work, but would mean only updating the three columns in the composite table if no other data was changed. |
@Danwhy technically if the "primary" content type is "deleted" then the "WHERE" clause will exclude it and the association does not matter. |
@nelsonic True, it was more the deletion of the actual association I was thinking of. For example, in CS if a venue wanted to remove a drink, but both the venue and drink still existed. |
For CS, YAGNI. (come back to it when the CS assoc table has 100k+ rows) |
@Danwhy can we automatically add a |
I was thinking about this, but hadn't had a chance to look into it yet. The same with |
@Danwhy please see: dwyl/alog#5 (thanks!) |
Although we are never deleting any records from our append only database, we still need a way to mark data as 'deleted', so it isn't shown to to users.
One solution could be to have an extra column in each table for 'deleted', and to mark that as
true
every time a user 'deletes' something. This would have the advantage of being easily reversible, ie. we could have a page that lists all 'deleted' items, and a button that 'undeletes' them, simply by marking 'deleted' asfalse
.The main issue we are facing is how to deal with deleting associations. We've come up with a way to keep associations among updated records, which should also work for deleted records (see #6). But this doesn't account for simply removing an association between two records.
The proposed solution above could work, but it might mean re-implementing a lot of what we already have. Ecto uses 'many to many' fields in schemas to automatically update composite tables. These tables currently consist of just two ids. It would probably be worth looking into how Ecto goes about updating these tables, and how easily we could instead do it ourselves.
Any suggestions or thoughts on the above two issues are welcome
The text was updated successfully, but these errors were encountered: