Cleaning up database fields, fix types and columns

This commit is contained in:
Nabeel Shahzad
2017-12-12 13:26:08 -06:00
parent e05976a982
commit d634778ed2
13 changed files with 78 additions and 83 deletions

View File

@@ -14,23 +14,23 @@ class CreatePirepTables extends Migration
public function up()
{
Schema::create('pireps', function (Blueprint $table) {
$table->uuid('id');
$table->integer('user_id')->unsigned();
$table->integer('airline_id')->unsigned();
$table->integer('aircraft_id')->nullable();
$table->string('id', 12);
$table->unsignedInteger('user_id');
$table->unsignedInteger('airline_id');
$table->unsignedInteger('aircraft_id')->nullable();
$table->uuid('flight_id')->nullable();
$table->string('flight_number', 10)->nullable();
$table->string('route_code', 5)->nullable();
$table->string('route_leg', 5)->nullable();
$table->string('dpt_airport_id', 5);
$table->string('arr_airport_id', 5);
$table->double('flight_time', 19, 2)->unsigned();
$table->double('gross_weight', 19, 2)->nullable();
$table->double('fuel_used', 19, 2)->nullable();
$table->unsignedDecimal('flight_time', 19);
$table->unsignedDecimal('gross_weight', 19)->nullable();
$table->unsignedDecimal('fuel_used', 19)->nullable();
$table->string('route')->nullable();
$table->string('notes')->nullable();
$table->tinyInteger('source')->default(0);
$table->tinyInteger('status')->default(0);
$table->unsignedTinyInteger('source')->default(0);
$table->unsignedTinyInteger('status')->default(0);
$table->longText('raw_data')->nullable();
$table->timestamps();
$table->softDeletes();
@@ -44,16 +44,16 @@ class CreatePirepTables extends Migration
Schema::create('pirep_comments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->uuid('pirep_id');
$table->bigInteger('user_id', false, true);
$table->string('pirep_id', 12);
$table->unsignedInteger('user_id');
$table->text('comment');
$table->timestamps();
});
Schema::create('pirep_events', function(Blueprint $table) {
$table->bigIncrements('id')->unsigned();
$table->uuid('pirep_id');
$table->string('event');
$table->bigIncrements('id');
$table->string('pirep_id', 12);
$table->string('event', 64);
$table->dateTime('dt');
});
@@ -62,7 +62,7 @@ class CreatePirepTables extends Migration
*/
Schema::create('pirep_expenses', function (Blueprint $table) {
$table->bigIncrements('id');
$table->uuid('pirep_id');
$table->string('pirep_id', 12);
$table->string('name');
$table->double('value', 19, 2)->nullable();
@@ -71,9 +71,9 @@ class CreatePirepTables extends Migration
Schema::create('pirep_fares', function (Blueprint $table) {
$table->bigIncrements('id');
$table->uuid('pirep_id');
$table->string('pirep_id', 12);
$table->unsignedBigInteger('fare_id');
$table->double('count', 19, 2)->nullable();
$table->unsignedInteger('count')->nullable();
$table->index('pirep_id');
});
@@ -84,15 +84,15 @@ class CreatePirepTables extends Migration
Schema::create('pirep_fields', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name', 50);
$table->integer('required');
$table->boolean('required')->default(false);
$table->timestamps();
});
Schema::create('pirep_field_values', function (Blueprint $table) {
$table->bigIncrements('id');
$table->uuid('pirep_id');
$table->string('pirep_id', 12);
$table->string('name', 50);
$table->text('value');
$table->string('value')->nullable();
$table->string('source')->nullable();
$table->timestamps();