在Laravel中恢复数据库备份扩展包推荐: laravel-backup-restore
Laravel  /  管理员 发布于 3个月前   165
(Laravel Backup Restore)Laravel备份恢复是一个包,用于恢复用Spatie的laravel-backup包做的数据库备份:
这个包提供了一个Artisan命令来恢复备份,以及一些可定制的健康检查和备份完整性检查。
下面是该项目README中的一个artisan命令的例子:
php artisan backup:restore
--disk=s3
--backup=latest
--connection=mysql
--password=my-secret-password
--reset
在备份被恢复后,这个软件包将运行一些健康检查,以确保备份被成功恢复。
它检查的内容包括确保数据库有表。
你也可以添加你自己的自定义检查,你可以配置为在备份:
恢复后运行:
namespace App\HealthChecks;
use Wnx\LaravelBackupRestore\PendingRestore;
use Wnx\LaravelBackupRestore\HealthChecks\HealthCheck;
class MyCustomHealthCheck extends HealthCheck
{
public function run(PendingRestore $pendingRestore): Result
{
$result = Result::make($this);
// We assume that your app generates sales every day.
// This check ensures that the database contains sales from yesterday.
$newSales = \App\Models\Sale::query()
->whereBetween('created_at', [
now()->subDay()->startOfDay(),
now()->subDay()->endOfDay()
])
->exists();
// If no sales were created yesterday, we consider the restore as failed.
if ($newSales === false) {
return $result->failed('Database contains no sales from yesterday.');
}
return $result->ok();
}
}
请务必查看该软件包的自述,了解一个GitHub动作的例子,
https://github.com/stefanzweifel/laravel-backup-restore#check-backup-integrity-automatically-with-github-actions
你可以用它来增量验证备份的完整性。
你可以在GitHub上了解更多关于这个包的信息,获得完整的安装说明,
https://github.com/stefanzweifel/laravel-backup-restore
并查看源代码。
路人 在
php中使用hyperf框架调用讯飞星火大模型实现国内版chatgpt功能示例中评论 教程很详细,如果加个前端chatgpt对话页面就完美了..博主 在
科学上网翻墙之v2rayN-Core客户端免费公益节点使用教程中评论 @ mashrdn 多切换几个节点测试,免费ssr是没那么稳..mashrdn 在
科学上网翻墙之v2rayN-Core客户端免费公益节点使用教程中评论 V2rayn免费节点添加上去了,youtobe无法打开网页,是怎么回事..张伟 在
科学上网翻墙之v2rayN-Core客户端免费公益节点使用教程中评论 3q!有用,不过免费节点隔天就要去git上复制新的导进去..博主 在
科学上网翻墙访问Google , 上外网神器佛跳墙VPN(永久免费)使用流程步骤中评论 该篇教程已不能用了,告知大家,免的老有老铁问我!..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号