CreateFileTranslationsTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 17
rs 9.4286
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
class CreateFileTranslationsTable extends Migration
7
{
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function up()
14
    {
15
        Schema::create(
16
            'media__file_translations',
17
            function (Blueprint $table) {
18
                $table->engine = 'InnoDB';
19
                $table->increments('id');
20
                $table->integer('file_id')->unsigned();
21
                $table->string('locale')->index();
22
                $table->string('description');
23
                $table->string('alt_attribute');
24
                $table->string('keywords');
25
                $table->unique(['file_id', 'locale']);
26
                $table->foreign('file_id')->references('id')->on('media__files')->onDelete('cascade');
27
            }
28
        );
29
    }
30
31
    /**
32
     * Reverse the migrations.
33
     *
34
     * @return void
35
     */
36
    public function down()
37
    {
38
        Schema::drop('media__file_translations');
39
    }
40
}
41