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:
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: