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;
use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Aircraft
@ -13,8 +12,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/
class Aircraft extends Model
{
use SoftDeletes;
public $table = 'aircraft';
protected $dates = ['deleted_at'];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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