Total Complexity | 2 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
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() |
||
41 | } |
||
42 | } |
||
43 |