1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Illuminate\Support\Facades\Schema; |
4
|
|
|
use Illuminate\Database\Schema\Blueprint; |
5
|
|
|
use Illuminate\Database\Migrations\Migration; |
6
|
|
|
|
7
|
|
|
class CreateApplicationReviews extends Migration |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Run the migrations. |
11
|
|
|
* |
12
|
|
|
* @return void |
13
|
|
|
*/ |
14
|
|
|
public function up() |
15
|
|
|
{ |
16
|
|
|
Schema::create('application_reviews', function (Blueprint $table) { |
17
|
|
|
$table->increments('id'); |
18
|
|
|
$table->integer('job_application_id')->unsigned(); |
19
|
|
|
$table->integer('review_status_id')->unsigned(); |
20
|
|
|
$table->integer('review_decision_id')->unsigned(); |
21
|
|
|
$table->string('reviewer')->nullable(); |
22
|
|
|
$table->text('notes')->nullable(); |
23
|
|
|
$table->timestamps(); |
24
|
|
|
}); |
25
|
|
|
|
26
|
|
|
Schema::create('review_statuses', function (Blueprint $table) { |
27
|
|
|
$table->increments('id'); |
28
|
|
|
$table->string('name'); |
29
|
|
|
$table->timestamps(); |
30
|
|
|
}); |
31
|
|
|
|
32
|
|
|
Schema::create('review_decisions', function (Blueprint $table) { |
33
|
|
|
$table->increments('id'); |
34
|
|
|
$table->string('name'); |
35
|
|
|
$table->timestamps(); |
36
|
|
|
}); |
37
|
|
|
|
38
|
|
|
Schema::table('application_reviews', function (Blueprint $table) { |
39
|
|
|
$table->foreign('job_application_id')->references('id')-> |
40
|
|
|
on('job_applications')->onUpdate('CASCADE')->onDelete('CASCADE'); |
41
|
|
|
$table->foreign('review_status_id')->references('id')-> |
42
|
|
|
on('review_statuses')->onUpdate('CASCADE')->onDelete('NO ACTION'); |
43
|
|
|
$table->foreign('review_decision_id')->references('id')-> |
44
|
|
|
on('review_decisions')->onUpdate('CASCADE')->onDelete('NO ACTION'); |
45
|
|
|
}); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Reverse the migrations. |
50
|
|
|
* |
51
|
|
|
* @return void |
52
|
|
|
*/ |
53
|
|
|
public function down() |
54
|
|
|
{ |
55
|
|
|
Schema::dropIfExists('application_reviews'); |
56
|
|
|
Schema::dropIfExists('review_statuses'); |
57
|
|
|
Schema::dropIfExists('review_decisions'); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|