1π
I agree with @web-engineer, adding a nullable column with the datetime of when the row has been soft-deleted is the best. I used this ressource to do this.
And to answer the second part of your question, yes an extra table will be needed. There is a third party app named django-simple-history which handles it for you.
0π
Best option is the second one, in your first example itβs not a soft delete if your deleting it from the table β soft should be to modify the data in a minimal way. Leaving the row in place is the purpose of a soft-delete, this has the minimal effect on the data and will retain all attributes such as primary key index value and any internals you cant see that the database might use.
Your first option is far less succinct as it means duplicating data structures. A common approach is to add a "deleted_at" column (default to NULL), this positively identifies the record state.
- [Answered ]-How to delete an object in django-channels -socket?
- [Answered ]-Attributeerror: 'module' object has no attribute 'register_success'
- [Answered ]-Redirect all page not found to home page