appzap/migrator 问题修复 & 功能扩展

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

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

appzap/migrator

Composer 安装命令:

composer require appzap/migrator

包简介

A TYPO3 Extension for SQL Migrations

README 文档

README

A TYPO3 Extension for SQL Migrations

Today TYPO3 projects are mostly developed and deployed using git. This extension can help you to work with SQL changes in this environment. Apply SQL changes on all developer instances or even deploy changes to your Live System.

What it does

The migrator just executes numbered sql files (001.sql, 002.sql, etc) that you place in a certain directory. Once the migrator is called it checks for new .sql files and executes them in the right order.

So if you want to distribute a SQL Command (e.g. an INSERT statement for a new record) accross your installations, just create a file with a higher number than the existing ones and push it into your repository. Once others pull it and execute the migrator they will have your changes applied!

Setup

  • Make sure the backend user _cli_lowlevel exists. It doesn't need any rights.
  • Create a folder where you want to have your SQL files. If it is inside your web root, protect it with a .htaccess file with the following contents: deny from all.
  • Install this Extension using the Extension Manager.
  • Configure it in the Extension Manager.
  • Path to the folder with SQL files: Relative path to the folder you just created.
  • Path to the mysql binary: Adjust to the mysql binary on your machine.

Invoke

The Migrator can be invoked in two ways:

Command Line

$php cli_dispatch.phpsh extbase migration:migratesqlfiles

Scheduler Task

Create a Scheduler Task of the class “Extbase Command Controller Task” and choose “Migrator Migration: migrateSqlFiles” as command. You can invoke the task regularly by cronjob or just by hand when you need it.

Troubleshooting

If the execution of an SQL file fails, the counter of the last last executed file is not increased and the file will be executed again on the next run. Notice that it already might have done changes to your database before it crashed.

If you want to see/change the internal pointer of the last executed SQL file, you’ll find it in the table sys_registry with the namespace and key AppZap\Migrator / lastExecutedVersion.

Can I omit migration numbers?

Yes, after 003.sql the next file can be 005.sql. Be aware once 005.sql is executed and you add 004.sql afterwards, 004.sql will never be executed.

Can I use timestamps as migration numbers?

Yes.

Can I start at 0?

No, at the moment the first file must be 001.sql or higher.

Do I need the leading zeros?

No, you can also use 1.sql and so on.

Can I undo a migration?

No, the migrator only knows one direction. You’ll need to do it manually.

appzap/migrator 适用场景与选型建议

appzap/migrator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 501 次下载、GitHub Stars 达 9, 最近一次更新时间为 2014 年 07 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 appzap/migrator 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2014-07-11