schickling/备份

本包最新版本(0.6.0)没有可用的许可证信息。

支持Laravel 4应用的数据库备份和恢复

0.6.0 2014-12-14 09:18 UTC

This package is not auto-updated.

Last update: 2024-09-23 14:33:51 UTC


README

支持Laravel 4应用的数据库备份和恢复

安装

  1. 运行以下命令
$ composer require schickling/backup
  1. Schickling\Backup\BackupServiceProvider 添加到您的 config/app.php 文件中

使用方法

备份

app/storage/dumps 创建备份文件

$ php artisan db:backup
使用特定数据库
$ php artisan db:backup --database=mysql
上传到AWS S3
$ php artisan db:backup --upload-s3 your-bucket

如果您不希望保留SQL备份的本地副本,可以使用 --keep-only-s3 选项。

使用aws/aws-sdk-php-laravel 包,需要配置

恢复

路径相对于 app/storage/dumps 文件夹。

恢复备份
$ php artisan db:restore dump.sql
列出备份
$ php artisan db:restore

配置

自版本 0.5.0 以来,本包遵循推荐的配置标准。为了配置本包,请运行以下命令

$ php artisan config:publish schickling/backup

所有设置都是可选的,并具有合理的默认值。

return array(

    // add a backup folder in the app/database/ or your dump folder
    'path' => app_path() . '/database/backup/',

    // add the path to the restore and backup command of mysql
    // this exemple is if your are using MAMP server on a mac
    // on windows: 'C:\\...\\mysql\\bin\\'
    // on linux: '/usr/bin/'
    // trailing slash is required
    'mysql' => array(
        'dump_command_path' => '/Applications/MAMP/Library/bin/',
        'restore_command_path' => '/Applications/MAMP/Library/bin/',
    ),

    // s3 settings
    's3' => array(
        'path'  => 'your/s3/dump/folder'
    )

    // Use GZIP compression
    'compress' => false,
);

依赖

...针对MySQL

您需要安装 mysqldump。它通常与MySQL本身一起安装。

待办事项 - 即将推出的功能

  • db:restore WRONGFILENAME 更详细的错误信息
  • db:backup FILENAME 为备份设置标题
  • S3
  • 默认上传
  • 默认存储桶
  • 更详细的文件夹检查(权限、存在性...)
  • 还有更多想法吗?告诉我!

Bitdeli Badge