CreateUrlAliasesTable::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateUrlAliasesTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('url_aliases', function (Blueprint $table) {
17
            $table->increments('id');
18
            $table->string('source')->index();
19
            $table->string('alias')->index();
20
            $table->string('locale')->nullable();
21
22
            $table->string('type', 5)->nullable(); // null - is alias | 301 | 302
23
            $table->string('model_type')->nullable();
24
            $table->unsignedBigInteger('model_id')->nullable();
25
            $table->string('locale_bound')->nullable();
26
27
            $table->index(['source', 'locale']);
28
            $table->unique(['alias', 'locale']);
29
            $table->unique(['model_type', 'model_id', 'locale']);
30
        });
31
    }
32
33
    /**
34
     * Reverse the migrations.
35
     *
36
     * @return void
37
     */
38
    public function down()
39
    {
40
        Schema::dropIfExists('url_aliases');
41
    }
42
}
43