d3nysm / stats-tables-cleaner-bundle
Cleans old entries from database stats tables
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.2.5
- doctrine/annotations: ^1.0
- doctrine/orm: ^2.8
- symfony/framework-bundle: ^5.1
This package is auto-updated.
Last update: 2024-12-01 00:11:34 UTC
README
This bundle helps with cleaning tables with statistics, logs, etc. The necessary thing is an entity must have date or datetime column.
Installation
$ composer require d3nysm/stats-tables-cleaner-bundle
Quick Start
-
Add the notation to your entity:
use App\Repository\StatsEntryRepository; use Doctrine\ORM\Mapping as ORM; use D3nysm\Bundle\StatsTablesCleaner\Annotation\CleanOldData; /** * @ORM\Entity(repositoryClass=StatsEntryRepository::class) * @ORM\Table(indexes={ * @ORM\Index(name="stat_date", columns={"date"})}) * @CleanOldData(interval="-3 month") */ class StatsEntry
Full settings of the annotation:
/** * @DeleteOldData(dateProp="createdAt", interval="-1 month", batchSize=500, eventName="app.my_best_event") */
-
Run the command and add to you scheduler system:
$ php bin/console stats-tables-cleaner:clean