Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃挕 Mass Prunable Functionality for Cycle ORM Entities #434

Open
lotyp opened this issue Aug 12, 2023 · 0 comments
Open

馃挕 Mass Prunable Functionality for Cycle ORM Entities #434

lotyp opened this issue Aug 12, 2023 · 0 comments
Labels
DX type:feature New feature.

Comments

@lotyp
Copy link
Member

lotyp commented Aug 12, 2023

I have an idea!

Introduce a mass prunable functionality in cycle/orm akin to what Laravel offers, allowing entities to be periodically pruned based on custom conditions. This enhancement will make managing large datasets more efficient and keep databases lean, especially for entities that are time-sensitive or have a shelf life.

Current Behavior:

Currently, cycle/orm doesn't provide out-of-the-box support for pruning entities based on conditions or age. Entities need to be manually queried and then removed, which can be cumbersome and inefficient for large datasets.

Desired Behavior:

  • Mass Pruning Support: Just as Laravel provides MassPrunable trait, cycle/orm should offer a similar mechanism, perhaps via attributes, to easily mark entities for mass pruning.
  • Prunable Conditions: Developers should be able to define conditions for pruning, like removing entities older than a month.
  • Efficiency: The pruning process should be efficient, using mass-deletion queries instead of deleting entities one by one.
  • Customizable Pruning Logic: Entities should have the ability to define custom logic before being pruned, e.g., removing associated files or resources.
  • Integration with Scheduling: Provide ways to schedule pruning operations, ensuring databases are kept lean without manual intervention.
  • Pretend Mode: Before actual pruning, provide an option to preview what would be pruned, aiding in debugging and ensuring safety.
  • Soft Delete Enhancement: Modify the SoftDelete behavior to support pruning. For example, entities could be marked as prunable using the PHP 8 attribute style:
[Behavior\SoftDelete(
	field: 'deletedAt',
	column: 'deleted_at',
	prunable: true
)]
@lotyp lotyp added the type:feature New feature. label Aug 12, 2023
@roxblnfk roxblnfk added the DX label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX type:feature New feature.
Projects
Status: Todo
Development

No branches or pull requests

2 participants