@@ -66,8 +66,8 @@ public function handle(CommandStarting $event)
6666 // Must pass along options or it may use wrong DB or have
6767 // inconsistent output.
6868 $ options = self ::inputToArtisanOptions ($ event ->input );
69- $ database = $ options ['--database ' ] ?? env ( ' DB_CONNECTION ' );
70- $ db_driver = \DB ::connection ( $ database )-> getDriverName ();
69+ $ database = $ options ['--database ' ] ?? \ DB :: getConfig ( ' name ' );
70+ $ db_driver = \DB ::getDriverName ();
7171 if (! in_array ($ db_driver , MigrateDumpCommand::SUPPORTED_DB_DRIVERS , true )) {
7272 // CONSIDER: Logging or emitting console warning.
7373 return ;
@@ -79,13 +79,13 @@ public function handle(CommandStarting $event)
7979 // Try-catch instead of information_schema since not all have one.
8080 try {
8181 $ has_migrated_any = ! is_null (
82- \DB ::connection ( $ database )-> table ('migrations ' )->value ('id ' )
82+ \DB ::table ('migrations ' )->value ('id ' )
8383 );
8484 } catch (\PDOException $ e ) {
8585 // No op. when table does not exist.
8686 if (
8787 ! in_array ($ e ->getCode (), ['42P01 ' , '42S02 ' ], true )
88- && ! preg_match ("/\bdoes ?n[o']t exist\b/iu " , $ e ->getMessage ())
88+ && ! preg_match ("/\b(does ?n[o']t exist|no such table) \b/iu " , $ e ->getMessage ())
8989 ) {
9090 throw $ e ;
9191 }
@@ -112,7 +112,7 @@ public static function inputToArtisanOptions(InputInterface $input) : array
112112 if (false !== $ input ->getParameterOption ($ option )) {
113113 $ options [$ option ] = true ;
114114 }
115- } else {
115+ } elseif ( false !== $ input -> getParameterOption ( $ option )) {
116116 $ options [$ option ] = $ input ->getParameterOption ($ option );
117117 }
118118 }
0 commit comments