| Total Complexity | 2 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class CreateSkillDeclarationsTable extends Migration |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Run the migrations. |
||
| 11 | * |
||
| 12 | * @return void |
||
| 13 | */ |
||
| 14 | public function up() |
||
| 15 | { |
||
| 16 | Schema::create('skill_declarations', function(Blueprint $table) |
||
| 17 | { |
||
| 18 | $table->increments('id'); |
||
| 19 | $table->integer('skill_id')->unsigned(); |
||
| 20 | $table->integer('skill_status_id')->unsigned()->nullable(); |
||
| 21 | $table->integer('skill_level_id')->unsigned()->nullable(); |
||
| 22 | $table->text('description')->nullable(); |
||
| 23 | $table->integer('applicant_id')->unsigned(); |
||
| 24 | $table->timestamps(); |
||
| 25 | }); |
||
| 26 | |||
| 27 | Schema::create('skill_statuses', function(Blueprint $table) |
||
| 28 | { |
||
| 29 | $table->increments('id'); |
||
| 30 | $table->string('name'); |
||
| 31 | $table->timestamps(); |
||
| 32 | }); |
||
| 33 | |||
| 34 | Schema::table('skill_declarations', function(Blueprint $table) |
||
| 35 | { |
||
| 36 | $table->foreign('applicant_id')->references('id')-> |
||
| 37 | on('applicants')->onUpdate('CASCADE')->onDelete('CASCADE'); |
||
| 38 | $table->foreign('skill_status_id')->references('id')-> |
||
| 39 | on('skill_statuses')->onUpdate('CASCADE')->onDelete('NO ACTION'); |
||
| 40 | $table->foreign('skill_level_id')->references('id')-> |
||
| 41 | on('skill_levels')->onUpdate('CASCADE')->onDelete('NO ACTION'); |
||
| 42 | }); |
||
| 43 | } |
||
| 44 | |||
| 45 | |||
| 46 | /** |
||
| 47 | * Reverse the migrations. |
||
| 48 | * |
||
| 49 | * @return void |
||
| 50 | */ |
||
| 51 | public function down() |
||
| 52 | { |
||
| 53 | Schema::drop('skill_declarations'); |
||
| 54 | Schema::dropIfExists('skill_statuses'); |
||
| 55 | } |
||
| 57 |