mdantas / phinx-wrapper
该包通过传递环境变量到命令或基于您的应用程序控制台来注入配置,从而简化了 phinx 配置。
1.0.0
2019-04-20 00:59 UTC
Requires
- robmorgan/phinx: 0.10.6
- vlucas/phpdotenv: 3.3.3
Requires (Dev)
- phpunit/phpunit: ^8.2@dev
This package is auto-updated.
Last update: 2024-09-21 04:34:42 UTC
README
没有其他库可以像 phinx 一样轻松简单地管理迁移,因此我创建了这个包,以便轻松地使用 phinx 命令或应用程序控制台,目的是您可以将命令添加到您的应用程序控制台或通过环境变量使用 bin/phinxwrap,或将 Phinx\Config\Config 注入到每个命令的构造函数中。
安装
composer require mdantas/phinx-wrapper //For generate env file, this not overwrite you env file. vendor/bin/phinxwrap init_env
需求
phinx 0.10.6
环境示例
DATABASE_MIGRATIONS_PATH=%%PHINX_CONFIG_DIR%%/db/migrations DATABASE_SEEDS_PATH=%%PHINX_CONFIG_DIR%%/db/seeds DATABASE_VERSION=creation DATABASE_STAGE=development DATABASE_ADAPTER=mysql DATABASE_NAME=development_db DATABASE_USER=root DATABASE_PASSWORD= DATABASE_HOST=localhost DATABASE_PORT=3306 DATABASE_CHARSET=utf8
示例
//In your app.php //Config read from env or inject any place you need. $config = \mdantas\PhinxWrap\PhinxConfiguration::envToConfigInterface(__DIR__.'/../') $application = new \mdantas\PhinxWrap\ConsoleApplication( $config );
public function __construct(\Phinx\Config\ConfigInterface $config) { $this->addCommands([ new Create($config), new Status($config), new Migrate($config), new Rollback($config), new SeedCreate($config), new SeedRun($config), new Test($config), ]); }
注意
所有 phinx 命令都基于包 Symfony Console。