reddogs-at/reddogs-doctrine-migrations

此包已被废弃,不再维护。作者建议使用 reddogs-at/reddogs-migrations 包。

特定模块的 Doctrine 迁移

1.0.0 2016-10-25 05:50 UTC

This package is not auto-updated.

Last update: 2019-02-20 19:04:44 UTC


README

Build Status Coverage Status Scrutinizer Code Quality Code Climate

特定模块的 Doctrine 迁移

安装

composer require reddogs-at/reddogs-doctrine-migrations

配置

我推荐使用 构建模块化应用,结合 Zend Expressive

在您的模块源路径中创建一个文件 ModuleConfig.php。例如,(e.g. module/YourModule/src) 或者将配置键 reddogs_doctrine_migrations 添加到现有配置

<?php

namespace YourModule;

class ModuleConfig
{
    public function __invoke()
    {
        return [
            'doctrine' => [
                'reddogs_doctrine_migrations' => [
                    'your_module' => [
                        'namespace' => 'YourModule',
                        'directory' => dirname(__DIR__) . '/data/migrations',
                        'table_name' => 'your_module_migrations'
                    ]
                ]
            ]
        ];
    }
}

配置选项

(参见Doctrine Migrations 文档中的自定义配置部分)

  • namespace: 您的模块命名空间
  • directory: 迁移类路径
  • table_name: 模块迁移表名称

用法

执行单个模块迁移(向上或向下)

  • 简单:/path/to/script.php mogrations:execute <moduleName> [--version=]
  • 所有参数:/path/to/script.php mogrations:execute <moduleName> [--version=] [--write-sql] [--dry-run] [--up] [--down] [--query-time] [--quiet|-q] [--no-interaction|-n] [--verbose|-v|-vv|-vvv]

生成新的空白模块迁移类

  • 简单:/path/to/script.php mogrations:generate <moduleName>
  • 所有参数:mogrations:generate <moduleName> [--quiet|-q] [--no-interaction|-n] [--verbose|-v|-vv|-vvv]

输出最新的模块迁移版本号

  • 所有参数:/path/to/script.php mogrations:latest <moduleName>

将模块迁移执行到指定版本或最新可用版本

  • 简单:/path/to/script.php mogrations:migrate <moduleName>
  • 所有参数:mogrations:migrate <moduleName> [--version=] [--dry-run] [--write-sql] [--query-time] [--quiet|-q] [--no-interaction|-n] [--verbose|-v|-vv|-vvv]

迁移所有注册的模块迁移

  • 所有参数:mogrations:migrate-all

查看一组模块迁移的状态

  • 所有参数:mogrations:status <moduleName>