File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
webfiori/framework/cli/commands Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,22 @@ public function exec() : int {
139139 $ this ->error ($ ex ->getMessage ());
140140 return -1 ;
141141 }
142- return $ this ->executeMigrations ($ runner );
142+ if ($ this ->isArgProvided ("--rollback " )) {
143+ return $ this ->rollbackMigration ($ runner );
144+ } else {
145+ return $ this ->executeMigrations ($ runner );
146+ }
147+ }
148+ private function rollbackMigration (MigrationsRunner $ runner ) {
149+ $ this ->println ("Rolling back last executed migration... " );
150+ $ migration = $ runner ->rollback ();
151+
152+ if ($ migration !== null ) {
153+ $ this ->success ("Migration ' " .$ migration ->getName ()."' was successfully rolled back. " );
154+ } else {
155+ $ this ->info ("No migration rolled back. " );
156+ }
157+ return 0 ;
143158 }
144159 private function executeMigrations (MigrationsRunner $ runner ) {
145160 $ this ->println ("Starting to execute migrations... " );
You can’t perform that action at this time.
0 commit comments