@@ 74-81 (lines=8) @@ | ||
71 | */ |
|
72 | public function migrate(ContainerInterface $container): void |
|
73 | { |
|
74 | foreach ($this->getMigrations($container) as $class) { |
|
75 | assert(is_string($class)); |
|
76 | $this->getIO()->writeInfo("Starting migration for `$class`..." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE); |
|
77 | /** @var MigrationInterface $migration */ |
|
78 | $migration = new $class($container); |
|
79 | $migration->init($container)->migrate(); |
|
80 | $this->getIO()->writeInfo("Migration finished for `$class`." . PHP_EOL, IoInterface::VERBOSITY_NORMAL); |
|
81 | } |
|
82 | } |
|
83 | ||
84 | /** |
|
@@ 91-98 (lines=8) @@ | ||
88 | */ |
|
89 | public function rollback(ContainerInterface $container): void |
|
90 | { |
|
91 | foreach ($this->getRollbacks($container) as $class) { |
|
92 | assert(is_string($class)); |
|
93 | $this->getIO()->writeInfo("Starting rollback for `$class`..." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE); |
|
94 | /** @var MigrationInterface $migration */ |
|
95 | $migration = new $class($container); |
|
96 | $migration->init($container)->rollback(); |
|
97 | $this->getIO()->writeInfo("Rollback finished for `$class`." . PHP_EOL, IoInterface::VERBOSITY_NORMAL); |
|
98 | } |
|
99 | ||
100 | $manager = $this->getConnection($container)->getSchemaManager(); |
|
101 | if ($manager->tablesExist([static::MIGRATIONS_TABLE]) === true) { |