Total Complexity | 2 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class CreateAssessmentsTable extends Migration |
||
8 | { |
||
9 | /** |
||
10 | * Run the migrations. |
||
11 | * |
||
12 | * @return void |
||
13 | */ |
||
14 | public function up() |
||
15 | { |
||
16 | Schema::create('assessments', function (Blueprint $table) { |
||
17 | $table->increments('id'); |
||
18 | $table->integer('screening_plan_id'); |
||
19 | $table->integer('criterion_id'); |
||
20 | $table->integer('assessment_type_id'); |
||
21 | $table->timestamps(); |
||
22 | |||
23 | $table->unique(['screening_plan_id', 'criterion_id', 'assessment_type_id']); |
||
24 | |||
25 | $table->foreign('screening_plan_id')->references('id')->on('screening_plans')->onUpdate('CASCADE')->onDelete('CASCADE'); |
||
26 | $table->foreign('criterion_id')->references('id')->on('criteria')->onUpdate('CASCADE')->onDelete('NO ACTION'); |
||
27 | $table->foreign('assessment_type_id')->references('id')->on('assessment_types')->onUpdate('CASCADE')->onDelete('NO ACTION'); |
||
28 | }); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Reverse the migrations. |
||
33 | * |
||
34 | * @return void |
||
35 | */ |
||
36 | public function down() |
||
39 | } |
||
40 | } |
||
41 |