julianpitt/dbmanager

为laravel项目提供高度可配置的数据库备份和恢复解决方案

1.0.3.4 2016-02-28 22:47 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:52:57 UTC


README

为laravel 5项目提供高度可配置的数据库备份和恢复解决方案

安装

通过Composer

$ composer require julianpitt/dbmanager

将服务提供者添加到config/app.php文件的provider数组中

...
    'JulianPitt\DBManager\DBManagerServiceProvider',
...

然后更新composer后发布配置

$ php artisan vendor:publish --provider="JulianPitt\DBManager\DBManagerServiceProvider" --tag="public"

使用方法

###控制台

备份

php artisan dbman:backup

恢复(目前处于开发中)

php artisan dbman:restore

###文件

DBManager::hasPermission( {filesystem name} );
DBManager::backup();
DBManager::backup( {options array} );

##配置

备份

默认值

prefix              => 'datetime'
suffix              => ''
filename            => '-db-manager'
compress            => true
keeplastonly        => false
filesystem          => "local"
location            => "/backups/"
useExtendedInsert   => true
timeoutInSeconds    => 60
tables              => ""
backupType          => "dataandstructure"
'individualFiles'   => env('DBMAN_OUTPUT_INDIVIDUAL', false),
'checkPermissions'  => env('DBMAN_CHECK_PERMISSIONS', true),
'failsafeEnabled'   =>  env('DBMAN_OUTPUT_FAILSAFE', true),
'failsafe'          => [
		'location'          => '/dbmanager/',
		'filesystem'        => 'local'
    ]

选项

  -p    --prefix=PREFIX                      The name of the file will get prefixed with this string.
  -s    --suffix=SUFFIX                      The name of the file will get suffixed with this string.
  -f    --filename=FILENAME                  The name of the file to output.
  -t    --type=TYPE                          The type of dump to perform on the database ("datanadstructure/dataonly/structureonly)
  -k    --keeplastonly=KEEPLASTONLY          Keep the last backup or delete all previous backups (true/false)
  -c    --compress=COMPRESS                  Compress the output file to .zip (true/false)
  -d    --checkPermissions=CHECKPERMISSIONS  Enable an initial check to see if the backup will run correctly [default: true]
  -b    --failsafeEnabled=FAILSAFEENABLED    Save a full backup in the failsafe location when performing a backup on some tables only [default: true]
  -i    --individual=INDIVIDUAL              Save each table to an individual file [default: false]

.env

以下值可以在您的.env文件中更改

 DBMAN_OUTPUT_COMPRESS      - compress (boolean)[true|false]
 DBMAN_OUTPUT_KEEPLASTONLY  - keeplastonly (boolean)[true|false]
 DBMAN_OUTPUT_FILESYSTEM    - filesystem (string or array) e.g ['local','aws'] or 'local'
 DBMAN_OUTPUT_LOCATION      - location (string) e.g '/backups/'
 DBMAN_OUTPUT_TABLES        - tables (string) e.g 'laravel' or '' for the whole database
 DBMAN_OUTPUT_BACKUPTYPE    - backupType (string) [dataonly|structureonly|dataandstructure]
 DBMAN_CHECK_PERMISSIONS    - checkPermissions (boolean)[true|false]
 DBMAN_OUTPUT_FAILSAFE      - failsafeEnabled (boolean)[true|false]
 DBMAN_OUTPUT_INDIVIDUAL    - individualFiles (boolean)[true|false]

变更日志

请参阅CHANGELOG获取更多最近更改的信息。

贡献

请参阅CONTRIBUTINGCONDUCT获取详细信息。

安全

如果您发现任何与安全相关的问题,请通过电子邮件julian.pittas@gmail.com报告,而不是使用问题跟踪器。

致谢

  • Julian Pittas

许可证

MIT许可证(MIT)。请参阅许可证文件获取更多信息