1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace LaraGeoData\Database; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Schema\Blueprint; |
6
|
|
|
|
7
|
|
|
class MigrationHelper |
8
|
|
|
{ |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @param Blueprint $table |
12
|
|
|
*/ |
13
|
13 |
|
public static function geonamesDefaultColumns(Blueprint $table): void |
14
|
|
|
{ |
15
|
13 |
|
$table->unsignedInteger('geoname_id'); |
16
|
13 |
|
$table->string('name', 200)->nullable()->index(); |
17
|
13 |
|
$table->string('ascii_name', 200)->nullable()->index(); |
18
|
13 |
|
$table->text('alternate_names')->nullable(); |
19
|
13 |
|
$table->decimal('lat', 10, 7)->nullable()->index(); |
20
|
13 |
|
$table->decimal('lng', 10, 7)->nullable()->index(); |
21
|
13 |
|
$table->char('fclass', 1)->nullable()->index(); |
22
|
13 |
|
$table->string('fcode', 10)->nullable()->index(); |
23
|
13 |
|
$table->string('country', 2)->nullable()->index(); |
24
|
13 |
|
$table->string('cc2', 200)->nullable()->index(); |
25
|
13 |
|
$table->string('admin1', 20)->nullable()->index(); |
26
|
13 |
|
$table->string('admin2', 80)->nullable()->index(); |
27
|
13 |
|
$table->string('admin3', 20)->nullable()->index(); |
28
|
13 |
|
$table->string('admin4', 20)->nullable()->index(); |
29
|
13 |
|
$table->unsignedInteger('population')->nullable()->index(); |
30
|
13 |
|
$table->integer('elevation')->nullable()->index(); |
31
|
13 |
|
$table->integer('gtopo30')->nullable()->index(); |
32
|
13 |
|
$table->string('timezone', 40)->nullable()->index(); |
33
|
13 |
|
$table->dateTime('moddate')->nullable()->index(); |
34
|
13 |
|
$table->unsignedSmallInteger('status')->default(1); |
35
|
13 |
|
$table->nullableTimestamps(); |
36
|
|
|
|
37
|
13 |
|
$table->primary('geoname_id'); |
38
|
13 |
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param Blueprint $table |
42
|
|
|
*/ |
43
|
9 |
|
public static function postalcodesDefaultColumns(Blueprint $table): void |
44
|
|
|
{ |
45
|
9 |
|
$table->string('postal_code', 50)->index(); |
46
|
9 |
|
$table->string('country_code', 10)->index(); |
47
|
9 |
|
$table->string('place_name', 100)->nullable(); |
48
|
9 |
|
$table->string('admin_name1', 100)->nullable(); |
49
|
9 |
|
$table->string('admin_code1', 80)->nullable()->index(); |
50
|
9 |
|
$table->string('admin_name2', 100)->nullable(); |
51
|
9 |
|
$table->string('admin_code2', 80)->nullable()->index(); |
52
|
9 |
|
$table->string('admin_name3', 100)->nullable(); |
53
|
9 |
|
$table->string('admin_code3', 80)->nullable()->index(); |
54
|
9 |
|
$table->decimal('lat', 10, 7)->nullable()->index(); |
55
|
9 |
|
$table->decimal('lng', 10, 7)->nullable()->index(); |
56
|
9 |
|
$table->unsignedSmallInteger('accuracy')->default(0); |
57
|
9 |
|
$table->unsignedSmallInteger('status')->default(1); |
58
|
9 |
|
$table->nullableTimestamps(); |
59
|
|
|
|
60
|
9 |
|
$table->primary('postal_code'); |
61
|
9 |
|
} |
62
|
|
|
} |
63
|
|
|
|