src/console/controllers/FlushController.php
public function actionPriceChanges($countDay = 30)
    {
        if ($count = ShopProductPriceChange::find()->where([
            '<=',
            'created_at',
            time() - 3600 * 24 * $countDay,
        ])->count()
        ) {
            $this->stdout("Total price changes for delete: {$count}\n", Console::BOLD);
            $totalDeleted = ShopProductPriceChange::deleteAll(['<=', 'created_at', time() - 3600 * 24 * $countDay]);
            $this->stdout("Total deleted: {$totalDeleted}\n");
        } else {
            $this->stdout("Нечего удалять\n", Console::BOLD);
        }
    }
public function actionPriceChanges($countDay = 30)
    {
        if ($count = ShopProductPriceChange::find()->where([
            '<=',
            'created_at',
            time() - 3600 * 24 * $countDay,
        ])->count()
        ) {
            $this->stdout("Total price changes for delete: {$count}\n", Console::BOLD);
            $totalDeleted = ShopProductPriceChange::deleteAll(['<=', 'created_at', time() - 3600 * 24 * $countDay]);
            $this->stdout("Total deleted: {$totalDeleted}\n");
        } else {
            $this->stdout("Нечего удалять\n", Console::BOLD);
        }
    }
Чистка лога изменения цен
@param int $countDay за последние количество дней