Skip to content

Commit c00ccb5

Browse files
authored
Merge pull request #8 from jameswilddev/master
Add "addressable" index
2 parents 2763012 + be23eef commit c00ccb5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class AddAddressableIndex extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('addresses', function (Blueprint $table) {
17+
$table->index(['addressable_type', 'addressable_id']);
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('addresses', function (Blueprint $table) {
29+
$table->dropIndex(['addressable_type', 'addressable_id']);
30+
});
31+
}
32+
}

0 commit comments

Comments
 (0)