diff --git a/classes/controller/migrate.php b/classes/controller/migrate.php index 2dbe933..807382c 100755 --- a/classes/controller/migrate.php +++ b/classes/controller/migrate.php @@ -104,13 +104,35 @@ public function action_fake() { $migrations = $this->runner->enumerateUpMigrations(); - $migration = array_pop($migrations); + foreach ($migrations as $migration) + { + $this->runner->setSchemaVersion( + $this->runner->migrationNameToVersion($migration) + ); + } + + print "==[ READY ]==\n"; + } - print "==[ $migration ]==\n"; + /** + * Mark all prev migrations as completed + */ + public function action_upgrade() + { + $current_version = $this->runner->getSchemaVersion(); + $migrations = $this->runner->enumerateMigrations(); + + foreach ($migrations as $migration) + { + $version = $this->runner->migrationNameToVersion($migration); + + if ($version < $current_version) + { + $this->runner->setSchemaVersion($version); + } + } - $this->runner->setSchemaVersion( - $this->runner->migrationNameToVersion($migration) - ); + print "==[ READY ]==\n"; } public function action_print()