Total Complexity | 2 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class MakeDegreeTable extends Migration |
||
8 | { |
||
9 | /** |
||
10 | * Run the migrations. |
||
11 | * |
||
12 | * @return void |
||
13 | */ |
||
14 | public function up() |
||
15 | { |
||
16 | Schema::create('degrees', function (Blueprint $table) { |
||
17 | $table->increments('id'); |
||
18 | $table->integer('degree_type_id')->unsigned()->nullable(); |
||
19 | $table->string('area_of_study')->nullable(); |
||
20 | $table->string('institution')->nullable(); |
||
21 | $table->string('thesis')->nullable(); |
||
22 | $table->date('start_date')->nullable(); |
||
23 | $table->date('end_date')->nullable(); |
||
24 | $table->integer('applicant_id')->unsigned(); |
||
25 | $table->timestamps(); |
||
26 | }); |
||
27 | |||
28 | Schema::create('degree_types', function (Blueprint $table) { |
||
29 | $table->increments('id'); |
||
30 | $table->string('name'); |
||
31 | $table->timestamps(); |
||
32 | }); |
||
33 | |||
34 | Schema::table('degrees', function (Blueprint $table) { |
||
35 | $table->foreign('degree_type_id')->references('id')-> |
||
36 | on('degree_types')->onUpdate('CASCADE')->onDelete('NO ACTION'); |
||
37 | $table->foreign('applicant_id')->references('id')-> |
||
38 | on('applicants')->onUpdate('CASCADE')->onDelete('CASCADE'); |
||
39 | }); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Reverse the migrations. |
||
44 | * |
||
45 | * @return void |
||
46 | */ |
||
47 | public function down() |
||
51 | } |
||
52 | } |
||
53 |