Skip to content

Commit 4e024ca

Browse files
improve import
1 parent 75f0bb1 commit 4e024ca

File tree

4 files changed

+100
-3
lines changed

4 files changed

+100
-3
lines changed

src/Utils/ParentData.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,16 @@ public static function getPerson($conn, $individuals, $obje_ids, $sour_ids)
9797
if (empty($check)) {
9898
$value = ['name' => $name, 'givn' => $givn, 'surn' => $surn, 'sex' => $sex, 'uid' => $uid, 'rin' => $rin, 'resn' => $resn, 'rfn' => $rfn, 'afn' => $afn];
9999

100-
$ParentData[] = $value;
100+
//$ParentData[] = $value;
101+
Person::on($conn)->insert($value);
101102
}
102103
// $person = Person::on($conn)->updateOrCreate($key,$value);
103104
// otherFields::insertOtherFields($conn,$individual,$obje_ids,$person);
104105
}
105106

106-
foreach (array_chunk($ParentData, 200) as $chunk) {
107+
/* foreach (array_chunk($ParentData, 200) as $chunk) {
107108
Person::on($conn)->insert($chunk);
108-
}
109+
} */
109110
otherFields::insertOtherFields($conn, $individuals, $obje_ids, $sour_ids);
110111
}
111112
catch (\Exception $e) {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class AddIndexKeyPeopleTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('people', function (Blueprint $table) {
17+
$table->index(['id', 'uid']);
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('people', function (Blueprint $table) {
29+
$table->dropIndex(['id', 'uid']);
30+
});
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class AddIndexKeyPersonEventTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('person_events', function (Blueprint $table) {
17+
$table->index(['id', 'person_id', 'addr_id']);
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('person_events', function (Blueprint $table) {
29+
$table->dropIndex(['id', 'person_id', 'addr_id']);
30+
});
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class AddIndexKeyPersonNameTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('person_name', function (Blueprint $table) {
17+
$table->index(['id', 'gid']);
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('person_name', function (Blueprint $table) {
29+
$table->dropIndex(['id', 'gid']);
30+
});
31+
}
32+
}

0 commit comments

Comments
 (0)