Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.
/ cleaner Public archive

Clear old data from different storages

License

Notifications You must be signed in to change notification settings

lamoda/cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lamoda cleaner

Build Status Scrutinizer Code Quality Code Coverage Build Status

Library that provides classes to clear old data from different storages, firstly from databases.

Installation

  1. Install library with composer:
composer require lamoda/cleaner

Standalone usage

Example of DoctrineDBALCleaner usage, which relies on doctrine/dbal connection.

use Lamoda\Cleaner\DB\Config\DBCleanerConfigFactory;
use Lamoda\Cleaner\DB\DoctrineDBALCleaner;

$config = DBCleanerConfigFactory::create([
    'query' => "DELETE * FROM big_table WHERE created_at < NOW() - (:interval || ' days')::interval",
    'parameters' => [
        'interval' => 90,
    ],
]);

/** @var \Doctrine\DBAL\Connection $connection */
$connection = $entityManager->getConnection();

$cleaner = new DoctrineDBALCleaner($connection, $config);
$cleaner->clear();