d3nysm / stats-tables-cleaner-bundle
从数据库的统计表中清理旧条目
1.0.3
2023-05-02 07:48 UTC
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-10-01 00:25:52 UTC
README
此包有助于清理包含统计数据、日志等的表格。必要的是实体必须具有日期或日期时间列。
安装
$ composer require d3nysm/stats-tables-cleaner-bundle
快速开始
-
将注解添加到您的实体中
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
注解的完整设置
/** * @DeleteOldData(dateProp="createdAt", interval="-1 month", batchSize=500, eventName="app.my_best_event") */
-
运行命令并将其添加到您的调度系统中
$ php bin/console stats-tables-cleaner:clean