Code Explainers

Code explainers tagged #soft-delete

java
@Entity
@Table(name = "orders")
@SQLDelete(sql = "UPDATE orders SET deleted = true, deleted_at = now() WHERE id = ?")
@Where(clause = "deleted = false")

Soft deletes with Hibernate in Spring

soft-delete jpa hibernate
Intermediate 9 steps
python
from django.db import models
from django.utils import timezone
 
 

How soft deletes work in Django

soft-delete querysets managers
Intermediate 10 steps
ruby
module SoftDeletable
  extend ActiveSupport::Concern
 
  included do

How a soft-delete concern works in Rails

concerns soft-delete scopes
Intermediate 8 steps
ruby
class Article < ApplicationRecord
  belongs_to :author
 
  default_scope { where(deleted_at: nil) }

How scopes compose in Rails

scopes query-composition activerecord
Intermediate 9 steps