rapide-software/sync-stack 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rapide-software/sync-stack

最新稳定版本:v0.1.9

Composer 安装命令:

composer require rapide-software/sync-stack

包简介

A package for creating and running synchronisations after a deploy, running only those which have not run yet, akin to migrations. Useful for CI/CD integration or multidatabase solutions where what has run before is not necessarily in sync across databases.

README 文档

README

A lightweight layer for running post-deploy synchronisations, similar to migrations but kept separate. It only executes sync files that have not been run before, making it handy for CI/CD pipelines or multi-database setups where environments may be out of sync.

Requirements

  • PHP ^8.0
  • Laravel 11.41.3^/12^

Installation

composer require rapide-software/sync-stack

The service provider is auto-discovered.

Setup

  1. Create the tracking table migration (defaults to synchronisations):
php artisan sync:migrate
php artisan migrate

Use --path to place the migration elsewhere or --realpath for absolute paths.

  1. (Optional) Choose where your sync files live. By default they sit in app/Synchronisations using StudlyCase folders. Pass --location to any sync command to override, or --fromBasePath to target an absolute path under base_path().

Creating synchronisations

Generate a new sync file (timestamped automatically):

php artisan sync:create --name="update_permissions" --location=Synchronisations

--abstractClass lets you extend your own base class for shared helpers. As of yet, this feature is very barebones and simply writes the extends line for you.

Each sync is an anonymous class with two hooks:

return new class {
    public function sync(): void {
        // Synchronize what you want synchronized.
    }

    public function rollback(): void {
        // Rollback logic to undo your synchronization
    }
};

Running synchronisations

Execute only the sync files that have not run yet:

php artisan sync:run --location=Synchronisations
  • Files are discovered recursively under --location and keyed by their path in the synchronisations table.
  • Each run uses the next batch number; --continueOnFailure keeps going after an error.

Rolling back

Undo the most recent batch of syncs:

php artisan sync:rollback --location=Synchronisations
  • Only the latest batch is rolled back; earlier batches stay intact.
  • Use --continueOnFailure to attempt the rest even if one rollback fails.

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-07