jalameta/jps-patcher
最新稳定版本:v2.0.0
Composer 安装命令:
composer require jalameta/jps-patcher
包简介
Laravel patch scripts.
README 文档
README
A (migration like) patcher for a smoldering production update.
Already tested on:
- Laravel: 6.* | 7.* | 8.*
Background :
Our team has been made a stupid thing that affect database in our project. It was happens many times, and we are usually go tinkering or direct edit on a database to fix those problems. The problem is we need to record those change, so we made this package. Besides, we sometime need to doing bulk insert user for our application, so patch will be the best solution.
INSTALLATION
do either of this methods below.
- via shell
composer require jalameta/jps-patcher
- adding
"jalameta/jps-patcher": "^2.0"tocomposer.json
{
"require": {
"jalameta/jps-patcher": "^2.0"
}
}
POST INSTALLATION
this process is optional, you can skip it though.
-
applying into your project.
-
Laravel >= 5.8
- Automatically loaded :)
-
Laravel <= 5.8
- Add the
\Jalameta\Patcher\PatcherServiceProviderintoprovidersarray inconfig/app.php
- Add the
-
-
patches table creation.
php artisan patcher:install
USAGE
CREATE NEW PATCH
for creating new patch you just need to run these following command
php artisan make:patch what_do_you_want_to_patch
wait, do you feels familiar huh?, we do too. The truth is, this package is extending laravel migration.
after run those command, you will see new file in patches folder.
Those file will be like:
<?php use Jalameta\Patcher\Patch; class WhatDoYouWantToPatch extends Patch { /** * Run patch script. * * @return void * @throws \Exception */ public function patch() { // } }
Method patch on these file will be filled with your logic.
in Jalameta\Patcher\Patch there is some useful properties
that you can use for supporting your patch such as:
-
$container: \Illuminate\Container\Container -
$command: \Illuminate\Console\Commandwe frequently used
$commandproperty to print process that we're doing. example:$this->command->warn('i patch something danger!'); $this->command->confirm('do you wish to continue?');
you can learn more about
\Illuminate\Console\Commandhere. -
$logger: \Illuminate\Log\Logger$loggerwill store log instorage/logs/patches.log. if you want to change it, add this line below in yourconfig/logging.phpin channels section.[ 'channels' => [ 'patcher' => [ 'driver' => 'patcher', // you can change me if you want 'path' => storage_path('logs/patches.log'), // change me ], ], ];you can learn more about
\Illuminate\Log\Loggerhere
SHOW PATCH STATUS
php artisan patcher:status
Example:
my_project on master [$!] via ⬢ v14.14.0 via 🐘 v7.4.11 on 🐳 v19.03.13 ➜ php artisan patcher:status +------+---------------------------------------+-------+ | Ran? | Patch | Batch | +------+---------------------------------------+-------+ | Yes | 2020_09_29_190531_fix_double_sections | 1 | | Yes | 2020_10_09_124616_add_attachment_beep | 1 | +------+---------------------------------------+-------+
RUN A PATCH(ES)
php artisan patcher:run
Example:
my_project on master [$!] via ⬢ v14.14.0 via 🐘 v7.4.11 on 🐳 v19.03.13
➜ php artisan patcher:status
Patches table created successfully.
Patching: 2020_09_29_190531_fix_double_sections
Patched: 2020_09_29_190531_fix_double_sections (0.03 seconds)
Patching: 2020_10_09_124616_add_attachment_beep
Patched: 2020_10_09_124616_add_attachment_beep (0.06 seconds)
统计信息
- 总下载量: 9.81k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-11