devture/ pimple-provider-phinx-migrations
Pimple 服务提供者,提供由 Phinx 驱动的数据库迁移功能
1.0
2022-12-17 11:40 UTC
Requires
- pimple/pimple: <4.0
- robmorgan/phinx: >=0.8.0,<0.14
README
这是一个Pimple服务提供者,它提供由Phinx驱动的数据库迁移控制台命令。
配置
$dbMigrationsConfig = [ 'environments' => [ 'default_database' => 'development', 'development' => [ 'adapter' => 'mysql', 'charset'=> 'utf8', 'collation' => 'utf8_general_ci', 'uri' => 'username:password@localhost/db_name', ], 'paths' => [ 'migrations' => 'migrations', ], 'migrations_base_path' => '/path/to/migrations-directory-parent', ], ];
用法
$container = new \Pimple\Container(); $container['console'] = function () use ($container) { $console = new \Symfony\Component\Console\Application(); // Register some other console commands here // Register the services provided by this service provider $container->register(new \Devture\PimpleProvider\PhinxMigrations\ServiceProvider($dbMigrationsConfig)); // Attach the console commands provided by this service provider with this console instance $container['devture_phinx_migrations.attach_commands_to_console']($console); return $console; }; $container['console']->run();