0

Using the Phinx there is a way to a specific migration call a seeder before the next migration?

Any way to programmatically call a seeder inside a migration?

Marcos
  • 1,240
  • 10
  • 20

1 Answers1

0

Not sure if the best way, but a solved the problem creating another PHP script who instantiated the Phinx classes and call the migrations and seeds conform needed.

$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);
Marcos
  • 1,240
  • 10
  • 20