Questions tagged [soft-delete]

Soft delete is to delete data from database in a way in which it can be recovered in the future rather than permanently deleting the data,

Soft delete, in database terminology, means to delete data from a database by generally marking it with flag like isDeleted rather than permanently deleting data. Soft delete helps in preserving data such that it can be recovered in the future rather than actually deleting it. Soft deleting also prevents accidental data losses.

367 questions
4
votes
0 answers

Why does where soft_delete make the query slower by factor 5?

I have a users table using Laravels Soft Delete which is essentially a null-able deleted_at column. If deleted_at is null, then the user was not deleted. I want to count the number for non-deleted users of a 130k users table who have been created…
Adam
  • 25,960
  • 22
  • 158
  • 247
4
votes
0 answers

Elasticsearch with symfony - Error populate command softdeletable entity

I use the symfony bundle Foselasticabundle and i am facing a problem. I have an entity (B) which can be deleted via gedmo softdeleteable. I created the mapping, via the YAML file, and when I execute the following command fos:elastica:populate i get…
flev
  • 37
  • 3
4
votes
2 answers

DRF and Token authentication with safe-deleted users?

I'm using a Django package named django-safedelete that allows to delete users without removing them from the database. Basically, it adds a delete attribute to the model, and the queries like User.objects.all() won't return the deleted models. You…
David Dahan
  • 10,576
  • 11
  • 64
  • 137
4
votes
1 answer

Performance: SoftDelete vs Move entries

I have a table in a PostreSQL database that holds advertisements. Every day, around 100k new advertisements are added and another 40k expire. Which approach is more suitable: having a disable flag but keeping them in the main database (index…
carina_
  • 45
  • 1
  • 6
4
votes
2 answers

Laravel: Override SoftDeletes trait properly

I want to make a trait that uses SoftDeletes named SoftDeletesWithStatus that will also update the status column. My problem is that I want to implement my code in the middle of SoftDeletes's functions like that: protected function runSoftDelete()…
JacopoStanchi
  • 1,962
  • 5
  • 33
  • 61
4
votes
2 answers

CakePHP 1.3 alternative to SoftDeletable Behavior?

Does anyone know of an alternative to the SoftDeletable Behavior that is compatible with Cake 1.3.x? If there aren't any ready behaviors available, any suggestions on how I go about doing this in the latest Cake? Figured out a quick hack. First and…
miCRoSCoPiC_eaRthLinG
  • 2,910
  • 4
  • 40
  • 56
4
votes
1 answer

Laravel force delete event on relations

I'm developing a Laravel web app using Laravel 5.2. My question is very simple... How do I listen to a forceDelete event in order to forceDelete model relations? I've been looking around the web and S.O. for a few but all the questions/answers I've…
IlGala
  • 3,331
  • 4
  • 35
  • 49
4
votes
1 answer

Physical delete a model which is enabled softdelete in laravel5?

I am using SoftDeletes for a model in Laravel5. But in some cases (Keeping history is not useful),I want to do physical delete (Removing row from table)instead of softDelete. class PaymentInvoices extends Model { use SoftDeletes; } Is…
gsk
  • 2,329
  • 8
  • 32
  • 56
4
votes
2 answers

JPA Specification: filter child entities

I successfully implemented a soft delete (aka delete flag) for the entities of my applications. However, I have one remaining problem. I've written a custom JPARepository with findAll and count methods that filter out the deleted ones. I do this…
Arthur C
  • 1,274
  • 1
  • 14
  • 34
4
votes
3 answers

Does Propel know when an object has been soft-deleted, so that child entities could still show their deleted parent?

I am soft-deleting objects in a MySQL database and using the Propel ORM. I have gotten soft-deleting to work, but at the cost of losing my enforced parent-child relationships, since the actual rows are not being deleted. Is there any way for Propel…
Nick
  • 1,049
  • 2
  • 8
  • 12
4
votes
2 answers

Best way to implement soft delete or archive with Core Data and server sync

I am trying to sync an iphone app with a web server using two flags - synched and is_deleted as described here https://stackoverflow.com/a/5052208 When the user deletes an item in the app, I set the is_deleted flag to true. Now I want to make sure…
4
votes
0 answers

Reasons for cascading soft deletes

In a relational database it seems quite common to use soft-deletes. My pondering comes to if it is really necessary to cascade these deletes? The reason I wonder is that it seems to me that cascading a soft delete wouldn't add any additional…
4
votes
0 answers

Soft delete in cascade in NHibernate

I try to make a soft delete by implementing the DeleteEvent Listener public class MyDeleteEventListener : DefaultDeleteEventListener { protected override void DeleteEntity(IEventSource session, object entity, EntityEntry entityEntry, bool…
Lullaby
  • 427
  • 9
  • 23
4
votes
1 answer

How to turn off pivot deletion when soft deleting in the main table?

I have a Users and a Groups table in Laravel's Eloquent ORM. There can be multiple users in a group and a user can be in multiple groups, so I use a pivot table to realize the many-to-many relationship. In real, the relationship isn't many-to-many…
totymedli
  • 29,531
  • 22
  • 131
  • 165
4
votes
2 answers

Rails - Soft Delete or Archive for active and non active data

I have read a lot about soft deletes and archive and saw all the pros and cons. I'm still confused on which approach would work best for my situation. I'll use the concept of posts and comments to see if I can explain it a bit easier Post ->…
bokor
  • 1,829
  • 1
  • 19
  • 25