photobank/backup-migrations

该包在执行迁移或种子之前对数据库进行备份

V0.1 2019-12-07 22:27 UTC

This package is auto-updated.

Last update: 2024-09-08 09:32:50 UTC


README

在执行迁移和种子之前执行数据库备份的存储库。

使用以下命令安装此包:

composer require fotobank/backup-migrations

在应用的服务提供者数组中注册

Fotobank\BackupMigrations\BackupMigrationsServiceProvider::class

服务提供者。

运行发布命令

php artisan vendor:publish --tag="backup-migrations"

以发布配置文件。

将以下内容添加到config/filesystems.php文件中disk 'backup'

\\
'backup' => [
	        'driver' => 'local',
	        'root' => storage_path('mysql_dump'),
	        'url' => env('APP_URL').'/storage',
	        'visibility' => 'public',
        ],
\\        

运行以下命令

php artisan migrate

php artisan db:seed

如常。在后台将进行数据库备份。

要恢复最新的备份,运行

php artisan migrate:restore

要指定备份文件,使用

--file=

选项。