Completed
Pull Request — dev (#297)
by Tristan
11:17
created

ReferenceFrequencyOnManager::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 18
dl 0
loc 24
rs 9.6666
c 2
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class ReferenceFrequencyOnManager extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::table('managers', function (Blueprint $table) {
17
            $table->integer('work_review_frequency_id')->unsigned();
18
            $table->integer('stay_late_frequency_id')->unsigned();
19
            $table->integer('engage_team_frequency_id')->unsigned();
20
            $table->integer('development_opportunity_frequency_id')->unsigned();
21
            $table->integer('refuse_low_value_work_frequency_id')->unsigned();
22
        });
23
24
        Schema::table('managers', function (Blueprint $table) {
25
            $table->foreign('work_review_frequency_id')->references('id')->on('frequencies')->onUpdate('CASCADE')->onDelete('NO ACTION');
26
            $table->foreign('stay_late_frequency_id')->references('id')->on('frequencies')->onUpdate('CASCADE')->onDelete('NO ACTION');
27
            $table->foreign('engage_team_frequency_id')->references('id')->on('frequencies')->onUpdate('CASCADE')->onDelete('NO ACTION');
28
            $table->foreign('development_opportunity_frequency_id')->references('id')->on('frequencies')->onUpdate('CASCADE')->onDelete('NO ACTION');
29
            $table->foreign('refuse_low_value_work_frequency_id')->references('id')->on('frequencies')->onUpdate('CASCADE')->onDelete('NO ACTION');
30
        });
31
32
        Schema::table('manager_translations', function (Blueprint $table) {
33
            $table->dropColumn('review_options');
34
            $table->dropColumn('staylate');
35
            $table->dropColumn('engage');
36
            $table->dropColumn('opportunities');
37
            $table->dropColumn('low_value_work_requests');
38
        });
39
    }
40
41
    /**
42
     * Reverse the migrations.
43
     *
44
     * @return void
45
     */
46
    public function down()
47
    {
48
        Schema::table('managers', function (Blueprint $table) {
49
            $table->dropForeign('managers_work_review_frequency_id_foreign');
50
            $table->dropForeign('managers_stay_late_frequency_id_foreign');
51
            $table->dropForeign('managers_engage_team_frequency_id_foreign');
52
            $table->dropForeign('managers_development_opportunity_frequency_id_foreign');
53
            $table->dropForeign('managers_refuse_low_value_work_frequency_id_foreign');
54
55
            $table->dropColumn('work_review_frequency_id');
56
            $table->dropColumn('stay_late_frequency_id');
57
            $table->dropColumn('engage_team_frequency_id');
58
            $table->dropColumn('development_opportunity_frequency_id');
59
            $table->dropColumn('refuse_low_value_work_frequency_id');
60
        });
61
62
        Schema::table('manager_translations', function (Blueprint $table) {
63
            $table->string('review_options')->nullable();
64
			$table->string('staylate')->nullable();
65
			$table->string('engage')->nullable();
66
			$table->string('opportunities')->nullable();
67
			$table->string('low_value_work_requests')->nullable();
68
        });
69
    }
70
}
71