定制 muhammadhuzaifa/laravel-safe-migration 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

muhammadhuzaifa/laravel-safe-migration

最新稳定版本:v1.1.0

Composer 安装命令:

composer require muhammadhuzaifa/laravel-safe-migration

包简介

The package provide a safest way to run migration commands by generating backup of the database before running the actual migration command.

README 文档

README

Latest Version on Packagist Total Downloads

The package provides safest way to run migration by generating backup of the database each time before the monitorable command probably the migrate* command is executed.

The laravel-safe-migration package feature for generating backup is build on top of spatie/laravel-backup package.

Installation

You can install the package via composer:

composer require muhammadhuzaifa/laravel-safe-migration

You can publish the config file with:

php artisan vendor:publish --tag="safe-migration-config"

This is the contents of the published config file:

return [
    /*
    |--------------------------------------------------------------------------
    | Safe Migration Enabled
    |--------------------------------------------------------------------------
    |
    | This value enable or disable the package functionality.
    |
    */

    "safe_migration_enabled" => env('SAFE_MIGRATION_ENABLED', true),
    /*
    |--------------------------------------------------------------------------
    | Commands To Monitor
    |--------------------------------------------------------------------------
    |
    | This value determined which commands package should listen to
    | make database backup before executing it.
    |
    */

    "commands_to_monitor" => [
        "migrate",
        'migrate:fresh',
        'migrate:refresh',
        'migrate:reset',
        'migrate:rollback',
    ],

    /*
    |--------------------------------------------------------------------------
    | Stop On Fail
    |--------------------------------------------------------------------------
    |
    | This value determined whether the migration should continue or not if the
    | backup creation fail.
    |
    */

    "stop_on_fail" => true,

    /*
    |--------------------------------------------------------------------------
    | Filename
    |--------------------------------------------------------------------------
    |
    | You can set the filename here. Timestamp and the extension will be appended
    | during the generation of the backup.
    |
    */

    "filename" => "safe-migration",
];

Usage

Once the package is installed and monitorable commands are configured under the config/safe-migration.php file. Each time you execute the monitorable command, the package will generate a backup file on the local disk by default. The backups can be found at storage/app/Laravel. You can customize the disks and other options using spatie config/backup.php file.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 49
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-01