使用Phinx 有没有一种方法可以在下一次迁移之前调用播种机的特定迁移?
有什么方法可以在迁移中以编程方式调用播种机?
不确定是否是最好的方法,但解决了创建另一个 PHP 脚本的问题,该脚本实例化了 Phinx 类并调用所需的迁移和种子。
$pdo = new PDO($configs['db']['dsn'], $configs['db']['username'], $configs['db']['password'], [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
]);
$config = new Config($configArray);
$manager = new Manager($config, new S
$config = new Config($configArray);
$manager = new Manager($config, new StringInput(' '), new ConsoleOutput());
$manager->migrate($environment, 20170825142637);
$manager->seed($environment, 'UserSeeder');
$manager->migrate($environment, 20170929000000);
$manager->seed($environment, 'ProductSeeder');
$manager->migrate($environment);