Total Complexity | 2 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class MakeCourseTable extends Migration |
||
8 | { |
||
9 | /** |
||
10 | * Run the migrations. |
||
11 | * |
||
12 | * @return void |
||
13 | */ |
||
14 | public function up() |
||
15 | { |
||
16 | Schema::create('courses', function (Blueprint $table) { |
||
17 | $table->increments('id'); |
||
18 | $table->string('name')->nullable(); |
||
19 | $table->string('institution')->nullable(); |
||
20 | $table->integer('course_status_id')->unsigned()->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::create('course_status', function (Blueprint $table) { |
||
28 | $table->increments('id'); |
||
29 | $table->string('name'); |
||
30 | $table->timestamps(); |
||
31 | }); |
||
32 | |||
33 | Schema::table('courses', function (Blueprint $table) { |
||
34 | $table->foreign('course_status_id')->references('id')-> |
||
35 | on('course_status')->onUpdate('CASCADE')->onDelete('NO ACTION'); |
||
36 | $table->foreign('applicant_id')->references('id')-> |
||
37 | on('applicants')->onUpdate('CASCADE')->onDelete('CASCADE'); |
||
38 | }); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Reverse the migrations. |
||
43 | * |
||
44 | * @return void |
||
45 | */ |
||
46 | public function down() |
||
50 | } |
||
51 | } |
||
52 |