herroffizier/yii2-dumpling

Dump and restore databases in Yii2.

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Type:yii2-extension

dev-develop 2016-03-24 16:21 UTC

This package is not auto-updated.

Last update: 2024-12-21 20:14:09 UTC


README

Build Status Scrutinizer Code Quality Code Coverage

Yii2 Dumpling is a simple Yii2 extension for dumping and restoring databases.

Installation

Install extension with Composer:

composer require "herroffizier/yii2-dumpling:@stable"

Update your app config:

// Add module to bootstrap
'bootstrap' => [

    // ...

    'dumpling',

    // ...

],

// Add module to app
'modules' => [

    // ...

    'dumpling' => [
        'class' => 'herroffizier\yii2dumpling\Module',
    ],

    // ...

],

And you're done.

Usage

Currently only MySQL databases are supported.

API

To dump database:

Yii::$app->dumpling->dump();

To restore database:

Yii::$app->dumpling->restore();

By default Dumpling uses db as database component and @app/runtime/dump.sql as dump file name. These values may be customized either by module config or by method arguments. Refer to source code for details.

In case of error yii\base\Exception will be thrown.

Console

You also may use Dumpling in a console.

To dump:

php yii dumpling/dump

To restore:

php yii dumpling/restore

Both commands supports --file and --db options for setting dump file name and database component accordingly.