You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.
Would it not make sense to use a unix timestamp to indicate deletion as opposed to a simple boolean?
It is certainly important to know when a record was deleted, not just whether it was. It could both be done with one column by storing unix timestamps instead of booleans. A set value means that the record was deleted AND it also tells you when. The column being NULL means the record has not been deleted. Furthermore this could be done consistently with TimestampBehavior by calling the attribute "deleted_at".
The only (and perhaps negligible) downside is the possibility of slightly higher storage requirement (using INT instead of BIT).
At the very least this could be a configurable option of SoftDelete.
The text was updated successfully, but these errors were encountered:
Since you are at it, could you call it "deleted_at" instead of deletedAt, to make it more consistent with Yii2's TimestampBehavior defaults for $createdAtAttribute and $updatedAtAttribute so that we end up with three:
created_at
updated_at
deleted_at
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Would it not make sense to use a unix timestamp to indicate deletion as opposed to a simple boolean?
It is certainly important to know when a record was deleted, not just whether it was. It could both be done with one column by storing unix timestamps instead of booleans. A set value means that the record was deleted AND it also tells you when. The column being NULL means the record has not been deleted. Furthermore this could be done consistently with TimestampBehavior by calling the attribute "deleted_at".
The only (and perhaps negligible) downside is the possibility of slightly higher storage requirement (using INT instead of BIT).
At the very least this could be a configurable option of SoftDelete.
The text was updated successfully, but these errors were encountered: