Remove 4 char restriction from ICAO; use decimal type for lat/lon #590 (#591)

* Remove 4 char restriction from ICAO; use decimal type for lat/lon #590

* Reorder imports
This commit is contained in:
Nabeel S 2020-02-26 17:06:39 -05:00 committed by GitHub
parent 14aacdfb75
commit f2b216c404
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
/**
* Turn the airport coordinates and other lat/lon coords into decimal type
*/
class ModifyAirportsCoordinates extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('acars', function ($table) {
$table->decimal('lat', 10, 5)->change()->default(0.0)->nullable();
$table->decimal('lon', 11, 5)->change()->default(0.0)->nullable();
});
Schema::table('airports', function ($table) {
$table->decimal('lat', 10, 5)->change()->default(0.0)->nullable();
$table->decimal('lon', 11, 5)->change()->default(0.0)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}

View File

@ -66,7 +66,7 @@ class Airport extends Model
* Validation rules * Validation rules
*/ */
public static $rules = [ public static $rules = [
'icao' => 'required|size:4', 'icao' => 'required',
'iata' => 'sometimes|nullable', 'iata' => 'sometimes|nullable',
'name' => 'required', 'name' => 'required',
'location' => 'sometimes', 'location' => 'sometimes',