Passed
Push — master ( 2c3721...94fb22 )
by Grant
09:10 queued 10s
created

CreateProjectsTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 12
dl 0
loc 32
rs 10
c 0
b 0
f 0
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateProjectsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('projects', function (Blueprint $table) {
17
            $table->increments('id');
18
            $table->string('name')->nullable();
19
            $table->integer('applicant_id')->unsigned();
20
            $table->date('start_date')->nullable();
21
            $table->date('end_date')->nullable();
22
            $table->timestamps();
23
        });
24
25
        Schema::table('projects', function (Blueprint $table) {
26
            $table->foreign('applicant_id')->references('id')->
27
                on('applicants')->onUpdate('CASCADE')->onDelete('CASCADE');
28
        });
29
    }
30
31
    /**
32
     * Reverse the migrations.
33
     *
34
     * @return void
35
     */
36
    public function down()
37
    {
38
        Schema::dropIfExists('projects');
39
    }
40
}
41