@@ -62,7 +62,8 @@ protected function configure()
6262 ->addArgument ('name ' , InputArgument::OPTIONAL , 'The name of the database to import ' )
6363 ->addOption ('server ' , null , InputOption::VALUE_REQUIRED , 'The ID or name of the database server to import a database to ' )
6464 ->addOption ('user ' , null , InputOption::VALUE_REQUIRED , 'The user used to connect to the database server ' )
65- ->addOption ('password ' , null , InputOption::VALUE_REQUIRED , 'The password of the user connecting to the database server ' );
65+ ->addOption ('password ' , null , InputOption::VALUE_REQUIRED , 'The password of the user connecting to the database server ' )
66+ ->addOption ('force ' , 'f ' , InputOption::VALUE_NONE , 'Force the import even if there are SQL errors ' );
6667 }
6768
6869 /**
@@ -97,7 +98,7 @@ protected function perform(InputInterface $input, OutputInterface $output)
9798
9899 $ output ->infoWithDelayWarning (sprintf ('Importing "<comment>%s</comment>" to the "<comment>%s</comment>" database ' , $ file , $ name ));
99100
100- $ command = sprintf ('%s %s | mysql --protocol=TCP --host=%s --port=%s --user=%s --password=%s %s ' , str_ends_with ($ file , '.sql.gz ' ) ? 'gunzip < ' : 'cat ' , $ file , $ host , $ port , $ user , $ password , $ name );
101+ $ command = sprintf ('%s %s | mysql %s --protocol=TCP --host=%s --port=%s --user=%s --password=%s %s ' , str_ends_with ($ file , '.sql.gz ' ) ? 'gunzip < ' : 'cat ' , $ file, $ this -> getBooleanOption ( $ input , ' force ' ) ? ' --force ' : '' , $ host , $ port , $ user , $ password , $ name );
101102
102103 Process::runShellCommandline ($ command , null , null );
103104
0 commit comments