private function applyMigration(Name $name, Direction $direction) { $migration = $this->service->createMigrationInstance($name, $this->output); if ($direction->isUp()) { $this->output->writeln('<info>Testing ' . $name . ' going up.</info>'); $migration->up($this->service->getDatabase()); } elseif ($direction->isDown()) { $this->output->writeln('<info>Testing ' . $name . ' going down.</info>'); $migration->down($this->service->getDatabase()); } }
private function applyMigration(Name $name, Direction $direction) { $fullClassName = 'Mongrate\\Migrations\\' . $name; $migration = new $fullClassName(); if ($direction->isUp()) { $this->output->writeln('<info>Testing ' . $name . ' going up.</info>'); $migration->up($this->service->getDatabase()); } elseif ($direction->isDown()) { $this->output->writeln('<info>Testing ' . $name . ' going down.</info>'); $migration->down($this->service->getDatabase()); } }
public function testIsUpFail() { $direction = new Direction(DirectionEnum::DOWN); $this->assertFalse($direction->isUp()); }
/** * Migrate up or down. * * @param Direction $direction */ public function migrate(Name $name, Direction $direction, OutputInterface $output) { $migration = $this->createMigrationInstance($name, $output); $output->writeln('<info>Migrating ' . $direction . '...</info> <comment>' . $name . '</comment>'); if ($direction->isUp()) { $migration->up($this->database); $this->setMigrationApplied($name, true); } else { $migration->down($this->database); $this->setMigrationApplied($name, false); } $output->writeln('<info>Migrated ' . $direction . '</info>'); }
/** * Migrate up or down. * * @param Direction $direction */ public function migrate(Name $name, Direction $direction, OutputInterface $output) { $this->loadMigrationClass($name); $fullClassName = $this->generateFullClassName($name); $migration = new $fullClassName(); $output->writeln('<info>Migrating ' . $direction . '...</info> <comment>' . $name . '</comment>'); if ($direction->isUp()) { $migration->up($this->database); $this->setMigrationApplied($name, true); } else { $migration->down($this->database); $this->setMigrationApplied($name, false); } $output->writeln('<info>Migrated ' . $direction . '</info>'); }