more schema adjustments to tighten up column types and constraints

This commit is contained in:
Nabeel Shahzad 2017-06-21 11:40:08 -05:00
parent 8dd29476c0
commit 381a713882
13 changed files with 19 additions and 43 deletions

View File

@ -3,7 +3,6 @@
namespace App\Models; namespace App\Models;
use Eloquent as Model; use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class Aircraft * Class Aircraft
@ -13,8 +12,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/ */
class Aircraft extends Model class Aircraft extends Model
{ {
use SoftDeletes;
public $table = 'aircraft'; public $table = 'aircraft';
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];

View File

@ -12,8 +12,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/ */
class AircraftClass extends Model class AircraftClass extends Model
{ {
//use SoftDeletes;
public $table = 'aircraft_classes'; public $table = 'aircraft_classes';
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];

View File

@ -3,7 +3,6 @@
namespace App\Models; namespace App\Models;
use Eloquent as Model; use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class Airline * Class Airline
@ -11,8 +10,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/ */
class Airline extends Model class Airline extends Model
{ {
use SoftDeletes;
public $table = 'airlines'; public $table = 'airlines';
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];

View File

@ -3,7 +3,6 @@
namespace App\Models; namespace App\Models;
use Eloquent as Model; use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class Airport * Class Airport
@ -11,8 +10,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/ */
class Airport extends Model class Airport extends Model
{ {
use SoftDeletes;
public $table = 'airports'; public $table = 'airports';

View File

@ -3,7 +3,6 @@
namespace App\Models; namespace App\Models;
use Eloquent as Model; use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class Fare * Class Fare
@ -13,8 +12,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/ */
class Fare extends Model class Fare extends Model
{ {
use SoftDeletes;
public $table = 'fares'; public $table = 'fares';
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];

View File

@ -3,7 +3,6 @@
namespace App\Models; namespace App\Models;
use Eloquent as Model; use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* Class Flight * Class Flight
@ -12,8 +11,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/ */
class Flight extends Model class Flight extends Model
{ {
use SoftDeletes;
public $table = 'flights'; public $table = 'flights';
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];

View File

@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use Zizaco\Entrust\Traits\EntrustUserTrait; use Zizaco\Entrust\Traits\EntrustUserTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* App\User * App\User

View File

@ -18,18 +18,18 @@ class CreateUsersTable extends Migration
$table->string('name')->nullable(); $table->string('name')->nullable();
$table->string('email')->unique(); $table->string('email')->unique();
$table->string('password'); $table->string('password');
$table->string('code')->nullable(); $table->integer('airline_id')->nullable()->unsigned();
$table->string('location')->nullable(); $table->integer('home_airport_id')->nullable()->unsigned();
$table->string('hub')->nullable(); $table->integer('curr_airport_id')->nullable()->unsigned();
$table->unsignedBigInteger('flights')->nullable(); $table->bigInteger('last_pirep_id')->nullable()->unsigned();
$table->float('hours')->nullable(); $table->bigInteger('flights')->nullable()->unsigned();
$table->float('pay')->nullable(); $table->bigInteger('flight_time')->nullable()->unsigned();
$table->boolean('confirmed')->nullable(); $table->decimal('balance', 19, 2)->nullable();
$table->boolean('retired')->nullable(); $table->tinyInteger('timezone')->default(0);
$table->dateTime('last_pirep')->nullable(); $table->boolean('active')->nullable();
$table->integer('timezone')->default(0);
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();
$table->softDeletes();
}); });
// Create table for storing roles // Create table for storing roles

View File

@ -19,7 +19,6 @@ class CreateAirlinesTable extends Migration
$table->string('name'); $table->string('name');
$table->boolean('active'); $table->boolean('active');
$table->timestamps(); $table->timestamps();
$table->softDeletes();
$table->index('code'); $table->index('code');
$table->unique('code'); $table->unique('code');

View File

@ -18,7 +18,6 @@ class CreateAircraftsTable extends Migration
$table->string('fuel_capacity')->nullable(); $table->string('fuel_capacity')->nullable();
$table->boolean('active')->default(true); $table->boolean('active')->default(true);
$table->timestamps(); $table->timestamps();
$table->softDeletes();
$table->index('icao'); $table->index('icao');
$table->unique('registration'); $table->unique('registration');
@ -30,7 +29,6 @@ class CreateAircraftsTable extends Migration
$table->string('name'); $table->string('name');
$table->string('notes')->nullable(); $table->string('notes')->nullable();
$table->timestamps(); $table->timestamps();
$table->softDeletes();
$table->index('code'); $table->index('code');
}); });

View File

@ -17,24 +17,22 @@ class CreateFaresTable extends Migration
$table->increments('id'); $table->increments('id');
$table->string('code'); $table->string('code');
$table->string('name'); $table->string('name');
$table->float('price')->default(0.0); $table->decimal('price', 19, 2)->default(0.0);
$table->float('cost')->default(0.0); $table->decimal('cost', 19, 2)->default(0.0);
$table->integer('capacity')->default(0); $table->integer('capacity')->default(0)->unsigned();
$table->string('notes')->nullable(); $table->string('notes')->nullable();
$table->boolean('active')->default(true); $table->boolean('active')->default(true);
$table->timestamps(); $table->timestamps();
$table->softDeletes();
}); });
Schema::create('aircraft_fare', function (Blueprint $table) { Schema::create('aircraft_fare', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->integer('aircraft_id'); $table->integer('aircraft_id')->unsigned();
$table->integer('fare_id'); $table->integer('fare_id')->unsigned();
$table->float('price')->nullable(); $table->decimal('price', 19, 2)->nullable();
$table->float('cost')->nullable(); $table->decimal('cost', 19, 2)->nullable();
$table->integer('capacity')->nullable(); $table->integer('capacity')->nullable()->unsigned();
$table->timestamps(); $table->timestamps();
$table->softDeletes();
}); });
} }

View File

@ -22,7 +22,6 @@ class CreateAirportsTable extends Migration
$table->float('lat', 7, 4)->default(0.0); $table->float('lat', 7, 4)->default(0.0);
$table->float('lon', 7, 4)->default(0.0); $table->float('lon', 7, 4)->default(0.0);
$table->timestamps(); $table->timestamps();
$table->softDeletes();
$table->index('icao'); $table->index('icao');
}); });

View File

@ -28,7 +28,6 @@ class CreateFlightsTable extends Migration
$table->text('notes')->nullable(); $table->text('notes')->nullable();
$table->boolean('active')->default(true); $table->boolean('active')->default(true);
$table->timestamps(); $table->timestamps();
$table->softDeletes();
$table->unique('flight_number'); $table->unique('flight_number');
@ -41,7 +40,6 @@ class CreateFlightsTable extends Migration
$table->increments('id'); $table->increments('id');
$table->integer('flight_id')->unsigned(); $table->integer('flight_id')->unsigned();
$table->integer('aircraft_id')->unsigned(); $table->integer('aircraft_id')->unsigned();
}); });
} }