Completed
Push — master ( 1ed12b...1ef741 )
by Nicolas
07:28
created

2016_07_12_181155032011_create_tag_tags_table.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateTagTagsTable 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
     * @return void
12
     */
13
    public function up()
14
    {
15
        Schema::create('tag__tags', function (Blueprint $table) {
16
            $table->engine = 'InnoDB';
17
            $table->increments('id');
18
            $table->string('namespace');
19
            $table->timestamps();
20
        });
21
22
        Schema::create('tag__tagged', function (Blueprint $table) {
23
            $table->increments('id');
24
            $table->string('taggable_type');
25
            $table->integer('taggable_id')->unsigned();
26
            $table->integer('tag_id')->unsigned();
27
            $table->index(['taggable_type', 'taggable_id']);
28
        });
29
    }
30
31
    /**
32
     * Reverse the migrations.
33
     * @return void
34
     */
35
    public function down()
36
    {
37
        Schema::drop('tag__tags');
38
        Schema::drop('tag__tagged');
39
    }
40
}
41