[ feature ] SoftDeletes mode bool/datetime #43382
Unanswered
gzhegow1991
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Main idea - make complex indexes with SQL databases smaller.
$table->unique(['slug', 'deleted_at']); to allow upsert records with same slug while older ones is still trashed.
Its possible with
deleted_at
withdate
type, but actually the index becomes bigger, and we should keep in mind that date - is integer that changes every second / microsecond. It means you need to store almost unique value as index, even if at the end of index string (internally).If there will be 'is_deleted' flag, indexes will be smaller, in case of 'dates' like deleted_at/created_at/updated_at in all cases should be stored in another table called 'action_log' to send notifications, see history and generate stats.
ps1. Only one benefit from that dates - is possible sorting by "deleting date", "creating date" and so on.
ps2. Guess its possible to add caster "boolean" to that date but not sure it will work.
ps3. After all...
is_deleted
- only one value... that maybe causes only two slug values at a time - slug/1 and slug/0, but still SQL has a rule - NULL equals nothing even another NULL for that.Beta Was this translation helpful? Give feedback.
All reactions