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()
|
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 = new LexiconEntryImportHandler();
|
||||||
$importHandler->run();
|
$this->info("Import in progress.");
|
||||||
|
$importHandler->run();
|
||||||
|
});
|
||||||
|
$this->info("Import Complete.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,15 +40,17 @@ class ImportUlbXmlData extends Command
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$this->info('Clearing out existing NT data...');
|
$this->info('Clearing out existing NT data...');
|
||||||
DB::statement("SET FOREIGN_KEY_CHECKS=0");
|
DB::transaction(function() {
|
||||||
DB::table('verses')->truncate();
|
DB::statement("SET FOREIGN_KEY_CHECKS=0");
|
||||||
DB::table('chapters')->truncate();
|
DB::table('verses')->truncate();
|
||||||
DB::table('books')->truncate();
|
DB::table('chapters')->truncate();
|
||||||
DB::table('words')->truncate();
|
DB::table('books')->truncate();
|
||||||
DB::statement("SET FOREIGN_KEY_CHECKS=1");
|
DB::table('words')->truncate();
|
||||||
|
DB::statement("SET FOREIGN_KEY_CHECKS=1");
|
||||||
|
|
||||||
$this->info('Importing fresh NT data...');
|
$this->info('Importing fresh NT data...');
|
||||||
$importHandler = new UlbXmlImportHandler($this->output);
|
$importHandler = new UlbXmlImportHandler($this->output);
|
||||||
$importHandler->run();
|
$importHandler->run();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue