定制 netcreaties/laravel-synchronize 二次开发

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

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

netcreaties/laravel-synchronize

最新稳定版本:v2.0.2

Composer 安装命令:

composer require netcreaties/laravel-synchronize

包简介

Laravel Synchronizations will enable you to create one time synchronizations and prevent creating commands you only use once

README 文档

README

Build Status Downloads Code Intelligence Status Scrutinizer Code Quality StyleCi

This package gives you the ability to create synchronization files and prevent you from having to write one time use commands when you've got for example: A database structure change that will require you to synchronize the old structure data with the new structure.

Documentation

Installation

The best way to install this package is through your terminal via Composer.

Run the following command from your projects root

composer require netcreaties/laravel-synchronize

Laravel 5.5+

This package supports package discovery.

Execute migrations

Getting started

Publish config (optional)

Publishing the config will enable you to overwrite some of the settings this package uses. For example you can define where synchronization files should be stored.

php artisan vendor:publish --provider="LaravelSynchronize\Providers\ServiceProvider" --tag="config"

Publish migration

php artisan vendor:publish --provider="LaravelSynchronize\Providers\ServiceProvider" --tag="migrations"

Execute migrations

php artisan migrate

Usage

Laravel Synchronize executes synchronizations that have the same class name as the migration class name, but with a Synchronization suffix, when executing migrations. This is the advised usage to ensure database integrity, but it is possible to execute synchronizations on their own (see section Synchronize command).

Make command

php artisan make:synchronization {name}

Creates the synchronization file at database/synchronizations

Synchronize command

php artisan synchronize

Using --class and --force

It can happen you need a synchronization before you can perform a migration. Using --class and --force can help you achieving that goal.

All you need to do is using the Laravel 5.8.16+ Migration events.

Example:

    public function __construct()
    {
        Event::listen(MigrationStarted::class, function (MigrationStarted $listener) {
            if ($listener->migration instanceof $this && $listener->method === 'up') {
                Artisan::call('synchronize --class=TestASync --force');
                echo Artisan::output();
            }
        });
    }

--force

--force will execute the synchronization even when it already has been run. Use with caution.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固