Wrap the import processed with a transaction
This commit is contained in:
parent
b8e68aec47
commit
82dcef8879
|
@ -39,9 +39,14 @@ class ImportLexicalEntries extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
DB::table('lexical_entries')->truncate();
|
||||
$this->info("Preparing to import lexical entries.");
|
||||
DB::transaction(function() {
|
||||
DB::table('lexical_entries')->truncate();
|
||||
|
||||
$importHandler = new LexiconEntryImportHandler();
|
||||
$importHandler->run();
|
||||
$importHandler = new LexiconEntryImportHandler();
|
||||
$this->info("Import in progress.");
|
||||
$importHandler->run();
|
||||
});
|
||||
$this->info("Import Complete.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,15 +40,17 @@ class ImportUlbXmlData extends Command
|
|||
public function handle()
|
||||
{
|
||||
$this->info('Clearing out existing NT data...');
|
||||
DB::statement("SET FOREIGN_KEY_CHECKS=0");
|
||||
DB::table('verses')->truncate();
|
||||
DB::table('chapters')->truncate();
|
||||
DB::table('books')->truncate();
|
||||
DB::table('words')->truncate();
|
||||
DB::statement("SET FOREIGN_KEY_CHECKS=1");
|
||||
DB::transaction(function() {
|
||||
DB::statement("SET FOREIGN_KEY_CHECKS=0");
|
||||
DB::table('verses')->truncate();
|
||||
DB::table('chapters')->truncate();
|
||||
DB::table('books')->truncate();
|
||||
DB::table('words')->truncate();
|
||||
DB::statement("SET FOREIGN_KEY_CHECKS=1");
|
||||
|
||||
$this->info('Importing fresh NT data...');
|
||||
$importHandler = new UlbXmlImportHandler($this->output);
|
||||
$importHandler->run();
|
||||
$this->info('Importing fresh NT data...');
|
||||
$importHandler = new UlbXmlImportHandler($this->output);
|
||||
$importHandler->run();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue