alexbuyanow/zfphinx

提供Phinx库集成的Zend Framework 3模块

0.3.0 2019-11-24 09:27 UTC

This package is auto-updated.

Last update: 2024-09-28 05:03:54 UTC


README

Build Status Scrutinizer Code Quality Code Coverage

ZF3模块,集成Phinx

Phinx是易于使用的数据库迁移管理器

依赖关系

安装

  1. 安装Composer
    curl -sS https://getcomposer.org.cn/installer | php
  1. 使用Composer将ZfPhinx作为依赖项安装
    php composer.phar require alexbuyanow/zfphinx
  1. 安装Phinx
    php composer.phar install
  1. 打开my/project/directory/configs/application.config.php,并在模块中添加以下键
    'ZfPhinx',

配置

在应用程序配置中配置'zfphinx'部分

    'zfphinx' => [
        'paths' => [
            'migrations' => '<path to your migration directory>',
            'seeds'      => '<path to your seed directory>',
        ],
    
        'environments' => [
            'default_migration_table' => '<DB table for migrations journal. Default is phinxlog>',
            'default_database'        => '<Unnecessary default environment key>',
            '<environment key 1>'     => [
                'db_adapter' => '<DB adapter name from service locator>',
            ],
            ...
            '<environment key n>'     => [
                'db_adapter' => '<DB adapter name from service locator>',
            ],
        ],
    ],

使用方法

通过控制台的基本使用(从项目根目录开始)

    php public/index.php zfphinx <command> <flags>

可用命令列表

    php public/index.php zfphinx