Skip to content

feat(orm): add optional explicit soft-delete support #505

Description

@GaspardKirira

Summary

Allow repositories to mark entities as deleted instead of physically removing their rows.

Soft-delete behavior must be opt-in and visible in repository configuration.

Current behavior

removeById() and removeAll() always execute physical DELETE statements.

Applications requiring archival behavior must implement custom repositories.

Expected behavior

A repository configured with a soft-delete column must:

  • update that column during removal;
  • exclude deleted rows from normal reads;
  • allow explicit access to deleted rows;
  • allow restoration where supported.

Scope

  • Define soft-delete metadata.
  • Support boolean soft-delete columns.
  • Support timestamp soft-delete columns.
  • Apply the condition to read operations.
  • Apply the condition to count and existence operations.
  • Add explicit include-deleted options.
  • Add restoration.
  • Add SQLite integration tests.
  • Preserve physical deletion for normal repositories.

Suggested files

  • modules/orm/include/vix/orm/Repository.hpp
  • modules/orm/include/vix/orm/SoftDelete.hpp
  • modules/orm/tests/soft_delete_test.cpp

Acceptance criteria

  • Soft delete is disabled by default.
  • Configured removal updates the marker.
  • Normal reads exclude deleted rows.
  • Explicit reads can include deleted rows.
  • Restoration clears the marker.
  • Physical deletion remains available explicitly.
  • Existing repositories remain unchanged.

Non-goals

This issue does not include:

  • automatic data retention policies;
  • scheduled cleanup;
  • relationship cascading;
  • audit history.

Suggested labels

  • scope:orm
  • type:feature
  • tests
  • help wanted
  • status:accepted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions