Optimize tables

This commit is contained in:
Miguel Nogueira 2020-04-29 21:16:05 +01:00
parent 7c22894e94
commit f514c4f848
5 changed files with 47 additions and 34 deletions

View File

@ -28,7 +28,7 @@ class CreateApplicationsTable extends Migration
'STAGE_INTERVIEW', 'STAGE_INTERVIEW',
'APPROVED', 'APPROVED',
'DENIED' 'DENIED'
]); ])->default('STAGE_SUBMITTED');
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -15,7 +15,14 @@ class CreateVotesTable extends Migration
{ {
Schema::create('votes', function (Blueprint $table) { Schema::create('votes', function (Blueprint $table) {
$table->id(); $table->id();
$table->bigInteger('userID')->unsigned();
$table->enum('allowedVoteType', [
'VOTE_DENY',
'VOTE_APPROVE'
]);
$table->timestamps(); $table->timestamps();
$table->foreign('userID')->references('id')->on('users');
}); });
} }

View File

@ -29,7 +29,7 @@ class CreateAppointmentsTable extends Migration
'SCHEDULED', 'SCHEDULED',
'CONCLUDED' 'CONCLUDED'
])->default('SCHEDULED'); ])->default('SCHEDULED');
$table->text('meetingNotes'); $table->text('meetingNotes')->nullable();
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('logs', function (Blueprint $table) {
$table->id();
$table->bigIncrements('userID');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('logs');
}
}

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class VotesHasApplication extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('votes_has_application', function (Blueprint $table){
$table->id('id');
$table->bigInteger('vote_id')->unsigned();
$table->bigInteger('application_id')->unsigned();
$table->timestamps();
$table->foreign('vote_id')->references('id')->on('votes');
$table->foreign('application_id')->references('id')->on('applications');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}