Completed
Push — master ( 52b765...0bec88 )
by David Martínez
02:19
created

CreateProposedLessonsTable::up()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 17

Duplication

Lines 12
Ratio 42.86 %

Importance

Changes 0
Metric Value
dl 12
loc 28
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 17
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 CreateProposedLessonsTable 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::create('proposed_lessons', function (Blueprint $table) {
0 ignored issues
show
Bug introduced by
The method create() does not exist on Illuminate\Support\Facades\Schema. Did you maybe mean createFreshMockInstance()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
17
            $table->increments('id');
18
            $table->integer('location_id')->unsigned();
19
            $table->string('state')->nullable();
20
            $table->integer('desideratum_id')->unsigned();
21
            //todo userstamps??? https://github.com/WildSideUK/Laravel-Userstamps?? https://github.com/acacha/Laravel-Userstamps
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
22
            $table->timestamps();
23
        });
24
25
        //Ha de tindre id, location_id, timestamps, userstamps, desideratum_id,
26
        //relacions amb User i amb Studysubmodule
27
28 View Code Duplication
        Schema::create('proposed_lesson_user', function (Blueprint $table) {
0 ignored issues
show
Bug introduced by
The method create() does not exist on Illuminate\Support\Facades\Schema. Did you maybe mean createFreshMockInstance()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
            $table->integer('proposed_lesson_id')->unsigned();
30
            $table->integer('user_id')->unsigned();
31
            $table->timestamps();
32
            $table->unique(['proposed_lesson_id', 'user_id']);
33
        });
34
35 View Code Duplication
        Schema::create('proposed_lesson_studysubmodule', function (Blueprint $table) {
0 ignored issues
show
Bug introduced by
The method create() does not exist on Illuminate\Support\Facades\Schema. Did you maybe mean createFreshMockInstance()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
36
            $table->integer('proposed_lesson_id')->unsigned();
37
            $table->integer('studysubmodule_id')->unsigned();
38
            $table->timestamps();
39
            $table->unique(['proposed_lesson_id', 'studysubmodule_id']);
40
        });
41
    }
42
43
    /**
44
     * Reverse the migrations.
45
     *
46
     * @return void
47
     */
48
    public function down()
49
    {
50
        Schema::dropIfExists('proposed_lesson_studysubmodule');
51
        Schema::dropIfExists('proposed_lesson_user');
52
        Schema::dropIfExists('proposed_lessons');
53
    }
54
}
55