Passed
Pull Request — dev (#313)
by Tristan
06:51
created

MakeWorkExperienceTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 14
dl 0
loc 34
rs 10
c 2
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 16 1
A down() 0 3 1
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class MakeWorkExperienceTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('work_experiences', function (Blueprint $table) {
17
            $table->increments('id');
18
            $table->string('role')->nullable();
19
            $table->string('company')->nullable();
20
            $table->text('description')->nullable();
21
            $table->date('start_date')->nullable();
22
            $table->date('end_date')->nullable();
23
            $table->integer('applicant_id')->unsigned();
24
            $table->timestamps();
25
        });
26
27
        Schema::table('work_experiences', function (Blueprint $table) {
28
            $table->foreign('applicant_id')->references('id')->
29
                on('applicants')->onUpdate('CASCADE')->onDelete('CASCADE');
30
        });
31
    }
32
33
    /**
34
     * Reverse the migrations.
35
     *
36
     * @return void
37
     */
38
    public function down()
39
    {
40
        Schema::dropIfExists('work_experiences');
41
    }
42
}
43