定制 discorgento/module-migrations 二次开发

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

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

discorgento/module-migrations

Composer 安装命令:

composer require discorgento/module-migrations

包简介

A dev-friendly approach to quickly create migrations (patch data) on Magento 2

README 文档

README

A dev-friendly approach to keep track of database changes in Magento 2

GitHub Stars Total Downloads Latest Version on Packagist Join our Discord

Sponsors

Caravel X

[Install] [Usage] [🎭 Facades] [Notes]

Just changed something on the admin panel or on the database and now you need to replicate it again in all project environments, including other dev machines?

Magento supports data patches out of the box, but writing them can get verbose and repetitive quickly. This module greatly simplifies such process.

image From 50 lines to just 15, or simply 70% less code. SEVENTY percent fewer lines. But we're just getting started.

📥 Install

composer require discorgento/module-migrations

Note

This module is compatible with Magento 2.4.6 onward, from PHP 8.1 to 8.4.

🛠️ Usage

Demo

There's also an extended version in Brazilian Portuguese including CMS content management overview available here.

Basic Usage

  • in the module you're developing, create a php class under its Setup/Patch/Data/ dir;
  • make it extend Discorgento\Migrations\Setup\Migration;
  • put your logic inside the execute(), and run bin/magento setup:upgrade.

Sample data patch:

<?php declare(strict_types=1);

namespace Vendor\Module\Setup\Patch\Data;

use Discorgento\Migrations\Setup\Migration;

class CmsPageMyNewPage extends Migration
{
    public function __construct(
        Migration\Context $context
    ) {
        parent::__construct($context);
    }

    protected function execute()
    {
        // your database changes logic goes here
    }
}

Then run:

bin/magento setup:upgrade

That's it, you successfully ensured that your database changes got tracked in all enviroments.

Facades

Besides simplifying the basic data patch structure, this module also provides helpers for common Magento patch tasks, such as admin config, CMS content, and EAV attributes. Use these when your patch needs to create or update Magento data without writing the same low-level setup code every time.

See FACADES.md for more details, shared helper methods, and the full helper reference.

🗒 Notes

  • create an issue in this repo to report a bug;
  • Pull Requests are welcome;
  • we want YOU for our community!

discorgento/module-migrations 适用场景与选型建议

discorgento/module-migrations 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.6k 次下载、GitHub Stars 达 25, 最近一次更新时间为 2022 年 06 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 discorgento/module-migrations 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 discorgento/module-migrations 我们能提供哪些服务?
定制开发 / 二次开发

基于 discorgento/module-migrations 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 25
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-18