sinuspi/migri 问题修复 & 功能扩展

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

邮箱: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
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固