luckyframework / luckyframework/avram

Allow for updating records during soft delete

Open
#934 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I often need to update records when I soft delete beyond just the `soft_deleted_at`. One case is when you want to soft delete a record, but also have to anonymize everything for GDPR. Currently you have to update the record, then soft delete it. Depending on your cache and flow, this could leave a record live and in a weird state.

Since we're just doing an update on the soft delete anyway, let's just hook in to that so it happens in a single query.

The awkward thing will be differentiating between actual deletes. You don't want to try and update a record while actually deleting it. So this may mean that we need to consider an alternate interface for soft deletes.
Related: https://github.com/luckyframework/avram/issues/829

Contributor guide

Open the contributing guide

Research direction

Start by reading the soft-delete behavior described here and the related issue #829. Determine how the current interface distinguishes soft deletes from actual deletes, then define how additional record updates such as GDPR anonymization can occur in the same query. Done means soft deletes can apply those updates without affecting actual deletes.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal, postgresql
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.