@@ -806,6 +806,25 @@ protected static function runMigration(...$args)
806806 $ steps = explode ('= ' , $ steps );
807807 }
808808
809+ if ($ key === '--up ' || $ key === '--down ' ) {
810+
811+ if ($ steps [0 ] !== '--use-file ' ) {
812+ $ output = " \n" ;
813+ $ output .= ConsoleColor::white (" Please check docs for correct syntax to use for run:migration --up or --down --use-file " , 'light ' , 'red ' ) . " \n" ;
814+ echo $ output . "\n" ;
815+ exit ;
816+ }
817+
818+ $ filename = $ steps [1 ];
819+
820+ if (!empty ($ filename )) {
821+ $ command = Console::phpCommand () . 'migration/usefile/ ' . $ filename . '/ ' . $ key ;
822+ static ::runSystemCommand ($ command );
823+ exit ;
824+ }
825+
826+ }
827+
809828 if ($ key === '--rollback ' ) {
810829
811830 $ step = 0 ;
@@ -870,6 +889,45 @@ protected static function runMigration(...$args)
870889 exit ;
871890 }
872891
892+ if ($ key === '--export-shema ' || $ key === '--xs ' ) {
893+
894+ $ removeTables = '' ;
895+ $ filename = date ('Y-m-d-His ' );
896+
897+ $ command = Console::phpCommand () . 'migration/exportSchema/ ' .$ filename ;
898+
899+ if (isset ($ args [1 ]) && isset ($ steps [0 ])) {
900+ $ filename = ($ steps [1 ]) ?: $ filename ;
901+ $ command = Console::phpCommand () . 'migration/exportSchema/ ' .$ filename ;
902+ }
903+
904+ if (isset ($ args [2 ]) && !empty ($ args [2 ])) {
905+ $ list = explode ('= ' , $ args [2 ]);
906+ $ removeTables = str_replace (', ' ,'__ ' , $ list [1 ]);
907+ $ filename = $ steps [1 ];
908+ $ command = Console::phpCommand () . 'migration/exportSchema/ ' .$ filename .'/ ' .$ removeTables ;
909+ }
910+
911+ static ::runSystemCommand ($ command );
912+ exit ;
913+ }
914+
915+ if ($ key === '--dump-database ' || $ key === '--dd ' ) {
916+
917+ $ name = date ('Y-m-d-His ' );
918+
919+ $ command = Console::phpCommand () . 'migration/dumpDb/ ' .$ name ;
920+
921+ if (isset ($ args [1 ]) && !empty ($ args [1 ])) {
922+ $ step = explode ('= ' , $ args [1 ]);
923+ $ name = $ step [1 ];
924+ $ command = Console::phpCommand () . 'migration/dumpDb/ ' .$ name ;
925+ }
926+
927+ static ::runSystemCommand ($ command );
928+ exit ;
929+ }
930+
873931 if ($ key != null ) {
874932 $ steps = explode ('= ' , $ key );
875933 }
0 commit comments