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
10
votes
2 answers

Soft Delete - Use IsDeleted flag or separate joiner table?

Should we use a flag for soft deletes, or a separate joiner table? Which is more efficient? Database is SQL Server. Background Information A while back we had a DB consultant come in and look at our database schema. When we soft delete a record,…
Jon Raynor
  • 3,804
  • 6
  • 29
  • 43
10
votes
1 answer

Using Doctrine extension softdeleteable with api-platform

I'm building an API with Symfony 3.4 and api-platform. I want to use soft delete on my entity. I've installed DoctrineExtensions and StofDoctrineExtensionsBundle. config.yml: doctrine: dbal: connections: default: …
Hakim
  • 1,084
  • 11
  • 28
9
votes
1 answer

Soft Delete vs. DB Archive

Suggested Reading Similar: Are soft deletes a good idea? Good Article: http://weblogs.asp.net/fbouma/archive/2009/02/19/soft-deletes-are-bad-m-kay.aspx How I ended up here I strongly belive that when making software, anything done up front to…
Travis J
  • 81,153
  • 41
  • 202
  • 273
9
votes
0 answers

Symfony 4 @Gedmo\SoftDeleteable() for form with collection type form

I have problem with soft delete item with form collection in Symfony framework I want to add and remove items in relation with Symfony form collection, If I remove item from collection this item must soft deleted from relation records with below…
Mortie
  • 390
  • 9
  • 24
9
votes
3 answers

Soft Deletes ( IsHistorical column ) with EntityFramework

I'm working with a database where the designers decided to mark every table with a IsHistorical bit column. There is no consideration for proper modeling and there is no way I can change the schema. This is causing some friction when developing…
John Farrell
  • 24,673
  • 10
  • 77
  • 110
8
votes
2 answers

Entity Framework soft delete implementation using database interceptor not working

I have implemented a database soft delete (a boolean flag that marks entries as deleted) using the following tutorial: http://www.codeguru.com/csharp/csharp/soft-deleting-entities-cleanly-using-entity-framework-6-interceptors.html It seems to me a…
nest
  • 1,385
  • 1
  • 15
  • 34
7
votes
1 answer

Soft delete with unique constraint in Django

I have models with this layout: class SafeDeleteModel(models.Model): ..... deleted = models.DateTimeField(editable=False, null=True) ...... class MyModel(SafeDeleteModel): safedelete_policy = SOFT_DELETE field1 =…
Vito235
  • 71
  • 1
  • 2
7
votes
1 answer

Laravel still expects to find deleted_at column after I remove softDelete

I just removed softDelete from a table with this migration: Schema::table("items", function ($table) { $table->dropSoftDeletes(); }); But now every query results in: Column not found: 1054 Unknown column 'items.deleted_at' in 'where…
Dan
  • 1,249
  • 2
  • 16
  • 31
7
votes
1 answer

Hibernate: how to fetch only not-logically deleted objects

Nearly every table in our database has a FK to the Auditing table which logs created, updated and deleted status (date and username). We mapped the auditing table to the Auditing class and use it like this: @MappedSuperclass public class…
joeriMJ
  • 103
  • 2
  • 6
7
votes
6 answers

How to determine if a model uses soft deletes in Laravel 4.2

How do I determine if a model uses soft deletes in Laravel 4.2? In the Laravel API I found the function isSoftDeleting(), but apparently that was removed from Laravel 4.2 now that it uses the SoftDeletingTrait. How would I go about determining if a…
Chris
  • 4,277
  • 7
  • 40
  • 55
7
votes
1 answer

Laravel QueryException bypassing try-catch?

I am using Laravel 4, and the Eloquent ORM. In my system, when someone deletes a record, it has to check if it has any associated records. If it doesn't, then it may be deleted permanently. But if it does, just perform a softDeletion. The way that…
Gustavo Silva
  • 315
  • 2
  • 4
  • 11
7
votes
4 answers

Symfony2 / Doctrine: Reading "deleted" data when using Gedmo's doctrine extensions

I'm building a Symfony2 project and am using gedmo/doctrine-extensions (GitHub) to implement soft delete. My question is whether there's a way to "disable" or "override" softdelete, or even detect if something has been soft deleted. Here's the…
Nathan Rutman
  • 2,215
  • 2
  • 21
  • 25
6
votes
1 answer

Doctrine2 + soft delete as a state pattern

Doctrine2 docs said that soft-delete behavior should be better implemented as a State pattern But not provide any example of that implementation. How to achieve soft delete behavior using a state pattern?
canni
  • 5,737
  • 9
  • 46
  • 68
6
votes
2 answers

How to filter association entities across a mapping table using Spring Data JPA(Hibernate)?

Is there a way to filter a soft deleted many-to-many association using @OneToMany and @ManyToOne, across an intermediate entity(mapping table)? product and product_option_group are in N:M relation. I'm implementing the soft deletion using the…
user2652379
  • 782
  • 3
  • 9
  • 27
6
votes
4 answers

Get onlyTrashed() does not exist in query builder

I am trying to get trashed rows from table messages: public function trash() { return $this->onlyTrashed() ->where('user_id', '=', $this->_u) ->orWhere('receiver', '=', $this->_u) ->orderBy('deleted_at',…
user8517929
1
2
3
24 25