Completed
Push — feature/manager_view_app_profi... ( 5ff349...1f9820 )
by Tristan
06:53
created

DropApplicantProfileQuestionTranslationsTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 12
c 1
b 0
f 0
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 18 1
A up() 0 3 1
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class DropApplicantProfileQuestionTranslationsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::dropIfExists('applicant_profile_question_translations');
17
    }
18
19
    /**
20
     * Reverse the migrations.
21
     *
22
     * @return void
23
     */
24
    public function down()
25
    {
26
        Schema::create('applicant_profile_question_translations', function(Blueprint $table)
27
		{
28
			$table->increments('id');
29
			$table->integer('applicant_profile_question_id')->unsigned()->index('applicant_profile_question_trans_applicant_profile_question_idx'); //Custom index name because exceeds length limit
30
			$table->string('locale');
31
			$table->text('value');
32
			$table->text('description');
33
			$table->timestamps();
34
35
            $table->unique(['applicant_profile_question_id','locale'], 'app_profile_ques_trans_app_profile_question_id_locale_unique');
36
		});
37
38
        Schema::table('applicant_profile_question_translations', function(Blueprint $table)
39
		{
40
			//Custom foreign key name because default exceeds length limit  
41
			$table->foreign('applicant_profile_question_id', 'applicant_profile_question_trans_applicant_profile_question_fk')->references('id')->on('applicant_profile_questions')->onUpdate('CASCADE')->onDelete('CASCADE');
42
		});
43
    }
44
}
45