|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* webtrees-lib: MyArtJaub library for webtrees |
|
5
|
|
|
* |
|
6
|
|
|
* @package MyArtJaub\Webtrees |
|
7
|
|
|
* @subpackage GeoDispersion |
|
8
|
|
|
* @author Jonathan Jaubart <[email protected]> |
|
9
|
|
|
* @copyright Copyright (c) 2009-2022, Jonathan Jaubart |
|
10
|
|
|
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
declare(strict_types=1); |
|
14
|
|
|
|
|
15
|
|
|
namespace MyArtJaub\Webtrees\Module\GeoDispersion\Schema; |
|
16
|
|
|
|
|
17
|
|
|
use Fisharebest\Webtrees\Schema\MigrationInterface; |
|
18
|
|
|
use Illuminate\Database\Capsule\Manager as DB; |
|
19
|
|
|
use Illuminate\Database\Schema\Blueprint; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Upgrade the database schema from version 1 to version 2. |
|
23
|
|
|
*/ |
|
24
|
|
|
class Migration1 implements MigrationInterface |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* {@inheritDoc} |
|
28
|
|
|
* @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
29
|
|
|
*/ |
|
30
|
|
|
public function upgrade(): void |
|
31
|
|
|
{ |
|
32
|
|
|
$in_transaction = DB::connection()->getPdo()->inTransaction(); |
|
33
|
|
|
|
|
34
|
|
|
DB::schema()->create('maj_geodisp_views', static function (Blueprint $table): void { |
|
35
|
|
|
$table->integer('majgv_id')->autoIncrement(); |
|
36
|
|
|
$table->integer('majgv_gedcom_id')->index(); |
|
37
|
|
|
$table->string('majgv_view_class', 255); |
|
38
|
|
|
$table->enum('majgv_status', ['enabled', 'disabled'])->default('enabled'); |
|
39
|
|
|
$table->string('majgv_descr', 248); |
|
40
|
|
|
$table->string('majgv_analysis', 255); |
|
41
|
|
|
$table->tinyInteger('majgv_place_depth')->default(1); |
|
42
|
|
|
$table->tinyInteger('majgv_top_places')->default(0); |
|
43
|
|
|
$table->json('majgv_colors')->nullable(); |
|
44
|
|
|
|
|
45
|
|
|
$table->foreign('majgv_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade'); |
|
46
|
|
|
}); |
|
47
|
|
|
|
|
48
|
|
|
DB::schema()->create('maj_geodisp_mapviews', static function (Blueprint $table): void { |
|
49
|
|
|
$table->integer('majgm_id')->autoIncrement(); |
|
50
|
|
|
$table->integer('majgm_majgv_id')->index(); |
|
51
|
|
|
$table->string('majgm_map_id', 127); |
|
52
|
|
|
$table->string('majgm_mapper', 255); |
|
53
|
|
|
$table->string('majgm_feature_prop', 31); |
|
54
|
|
|
$table->json('majgm_config')->nullable(); |
|
55
|
|
|
|
|
56
|
|
|
$table->foreign('majgm_majgv_id')->references('majgv_id')->on('maj_geodisp_views')->onDelete('cascade'); |
|
57
|
|
|
}); |
|
58
|
|
|
|
|
59
|
|
|
if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) { |
|
60
|
|
|
DB::connection()->beginTransaction(); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|