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
3
votes
5 answers

Implementing soft delete with minimal impact on performance and code

There are some similar questions on the topic, but they are not really helping me. I want to implement a soft delete feature like on StackOverflow, where items are not really deleted, but just hidden. I am using a SQL database. Here are 3…
Aillyn
  • 23,354
  • 24
  • 59
  • 84
3
votes
2 answers

soft deleting mongoid document along with associated documents

I have 2 models, user and posts class User include Mongoid::Document include Mongoid::Paranoia references_many :posts, :autosave => true, :dependent => :destroy end class Post include Mongoid::Document referenced_in :user end Now when I…
Sadiksha Gautam
  • 5,032
  • 6
  • 40
  • 71
3
votes
5 answers

Re-using soft deleted records

If I have a table structure that is: code, description, isdeleted where code is the primary key. The user creates a record, then later on deletes it. Because I am using soft deletes the isdeleted will be set to true. Then in my queries I would be…
user11355
  • 531
  • 1
  • 8
  • 8
3
votes
1 answer

Soft Deleted Data but issue while fetching | EF Core, C#

I have an issue, I have 2 tables. as below. public class Campaign { public int CampaignId { get; set; } public string CampaignTitle { get; set; } public string CampaignObjective { get; set; } public int CurrencyId { get; set; } …
3
votes
1 answer

ASP.NET MVC coding with SQL Server database with composite keys & update cascade feature

I am using EF 6 with a database-first approach for my ASP.NET MVC project as I am more comfortable with SQL than C# & LINQ coding (using SQL Server 2008, Visual Studio 2015). I have 4 tables in SQL Server each for : Link, Employee, MapLinkEmp,…
3
votes
2 answers

Table bloat on Postgres

I have a small (~200GB) data warehouse running on Postgres 9.5.15 on AWS RDS instance. For robustness, I'm inserting new data into analytical schema (result of ELT) as follows: insert new slice remove the old slice using delete command vacuum I…
AlexYes
  • 4,088
  • 2
  • 15
  • 23
3
votes
2 answers

How to disable soft deletes in Laravel 5.8 Eloquent model

On my project all models extend BaseModel class, which uses SoftDeletes trait by default. But in some specific cases, e.g. in class ShouldHardDelete I don't want my DB records to be deleted softly. Let's suppose, I can't deny extending…
vvmul
  • 402
  • 4
  • 13
3
votes
1 answer

Disable softDelete Query filters for navigation properties

I use Ef Core 2.1, in which I enabled a soft-delete query filter. In some cases, I want to retrieve from an entity, a soft-deleted navigation property, but I could not retrieve the data (The navigation property is null because it was soft…
Ido
  • 168
  • 2
  • 15
3
votes
2 answers

Rails - Globalize and Permanent_record dependent: :destroy callbacks

In a Rails 4.2 project I use gem 'permanent_records' to handle records soft-deletion and gem 'globalize' for translations. Globalize sets the following relationships between the translated Model and the Translation Model (source): has_many…
davideghz
  • 3,596
  • 5
  • 26
  • 50
3
votes
5 answers

Questions related to soft delete in laravel

I have some questions relating to soft delete in laravel. I have search up on what it does and what it means and the most understandable part about soft delete is from this sentence "When models are soft deleted, they are not actually removed from…
blastme
  • 391
  • 7
  • 19
  • 37
3
votes
2 answers

rails_acts_as_paranoid to soft delete a record of a many to many relationship

Hi all I have users and messages, messages can be deleted by both receiver and sender, without affecting the each-other view. so when the sender deletes the message the receiver still sees it, hope I'm clear. I wouldd just add two attributes,…
ecoologic
  • 10,202
  • 3
  • 62
  • 66
3
votes
1 answer

Symfony ORM PostRemove with soft deletable

I have an entity category and another entity article joined with cat_id and cascaded remove. The category entity is softDeleteable When i try to delete a category, the default behaviour is to delete related articles because they are cascaded…
semsem
  • 1,194
  • 12
  • 24
3
votes
1 answer

Hibernate soft deletion for child table

Assume we have two entities Customer and AppUser, they are One-To-Many relationship. Customer Entity: @Entity @Table(name = "CUSTOMER") //Override the default Hibernation delete and set the deleted flag rather than deleting the record from the…
Tony
  • 351
  • 4
  • 16
3
votes
1 answer

DB Intercept causing SQL Nested too deeply

I'm using a DB intercept in entity framework 6 (code first model) in order to implement a soft delete function, however intermittently I'm getting a exception thrown from SQL Server stating "Some part of your SQL statement is nested too deeply.…
3
votes
2 answers

Laravel get relation from softdelete

I've got 2 tables, user intern A user belongsTo a intern, and a inter hasOne user. My problem is that when I've softdelete a user record and the related intern record. And I want to restore it i can't find the related intern anymore. So when I…
Jamie
  • 10,302
  • 32
  • 103
  • 186