定制 sinuspi/migri 二次开发

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

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

sinuspi/migri

Composer 安装命令:

composer require sinuspi/migri

包简介

Lightweight DB migration lib

README 文档

README

Migri is a simple schema migration library. It manages MySQL table creation and versioned migrations with version tracking in table comments.

Migrations are defined as an associative array, where keys define "checkpoints" (CREATE TABLE) or "transitions" (ALTER TABLE). Multiple table definitions can be daisy-chained.

Usage:

$db = new \mysqli(...); // or new \PDO(...)
new \SinusPi\Migri\Migri($db)
	->manageTable("users", [
		"1"   => "CREATE TABLE users (...)",
		"1>2" => "ALTER TABLE users ADD COLUMN ...",
		"2>3" => "ALTER TABLE users ADD COLUMN ...",
		"3"   => "CREATE TABLE users (...)",  // Reset point for fresh installs
		"3>4" => "ALTER TABLE users ADD COLUMN ...",
	])
	->manageTable("widgets", [
		"1" => "CREATE TABLE <TABLE> (...)"
	])
	;

All intermediate steps must be defined. Missing a step in the sequence throws an error.

Optionally, use <TABLE> placeholder to avoid repetition of table name.

Compatible with PHP 5.6+, \mysqli and \PDO.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-22