veejay/migration 问题修复 & 功能扩展

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

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

veejay/migration

最新稳定版本:0.1.0

Composer 安装命令:

composer require veejay/migration

包简介

Abstract migration engine for any database

README 文档

README

Abstract migration engine for any database.

License: MIT

Initialize

At first, you should create config file with command:

vendor/bin/migration init

Or you can create and edit migration.php file manually. Example config:

<?php

use Veejay\Migration\Repository\SqlRepository;

return [
    'path' => __DIR__ . '/migration',
    'repository' => new SqlRepository(
        'mysql:host=localhost;dbname=database',
        'root',
        'password',
        null,
        SqlRepository::MIGRATION_TABLE,
    ),
];

Create

Next command will create new migration file with name like m_000000_000000_my_1st_migration.

vendor/bin/migration create my_1st_migration

Then you should edit up() and down() methods according to your purposes.

<?php
declare(strict_types=1);

use Veejay\Migration\Unit\Migration;

final class m_000000_000000_my_1st_migration extends Migration
{
    public function up(): bool
    {
        $repository = $this->getRepository(); /* @var SqlRepository $repository */
        $sql = 'CREATE TABLE `test` (`id` INT AUTO_INCREMENT, `name` TEXT, PRIMARY KEY (`id`) USING BTREE)';
        return $repository->getDb()->execute($sql);
    }

    public function down(): bool
    {
        $repository = $this->getRepository(); /* @var SqlRepository $repository */
        $sql = 'DROP TABLE `test`';
        return $repository->getDb()->execute($sql);
    }
}

Run

Apply all migrations.

vendor/bin/migration migrate

Apply/revert to specific migration.

vendor/bin/migration migrate name_part

Print migration history.

vendor/bin/migration history

Custom database

You can write your own wrapper for any DB. Just implement Veejay\Migration\Repository\RepositoryInterface and use any storage you want.

Requirements

  • PHP 8.0+

Installation

composer require "veejay/migration"

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固