PHPackages                             cambis/silverstripe-pruner - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cambis/silverstripe-pruner

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

cambis/silverstripe-pruner
==========================

A simple developer utility to clear database tables.

v0.5.0(1y ago)151[2 issues](https://github.com/Cambis/silverstripe-pruner/issues)MITPHPPHP ^7.4 || ^8.0

Since Apr 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Cambis/silverstripe-pruner)[ Packagist](https://packagist.org/packages/cambis/silverstripe-pruner)[ RSS](/packages/cambis-silverstripe-pruner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (11)Used By (0)

Silverstripe Pruner
===================

[](#silverstripe-pruner)

A simple developer utility to clear database tables. This module provides a configurable task that truncates database tables inside of a transaction.

Prerequisites 🦺
---------------

[](#prerequisites-)

```
php ^7.4 || ^8.0
silverstripe/framework ^4.0 || ^5.0
```

Installation 👷‍♀️
-----------------

[](#installation-‍️)

Install via composer.

```
composer require --dev cambis/silverstripe-pruner
```

Configuration 🚧
---------------

[](#configuration-)

Create a configuration file.

```
---
Name: app_pruner
---
Cambis\SilverstripePruner\Task\PruneSelectedORMTablesTask:
  # List the fqn names of the DataObjects you want to truncate
  truncated_classes:
    - My\Record\To\Truncate
  # Any extra tables such as those from silverstripe/versioned etc.
  truncated_tables:
    - Truncate_Live
    - Truncate_Versions
  # Defaults to false, add this line if you want to run the task in a production environment
  can_run_in_production: true
```

You can also dynamically update the truncated tables using an extension hook. This library provides traits to with the hook method definitions.

```
