1: <?php
2:
3: use Illuminate\Database\Migrations\Migration;
4: use Illuminate\Database\Schema\Blueprint;
5: use Illuminate\Database\Capsule\Manager as Capsule;
6:
7: class CreateContactsIndexes extends Migration
8: {
9: /**
10: * Run the migrations.
11: *
12: * @return void
13: */
14: public function up()
15: {
16: Capsule::schema()->table('contacts', function (Blueprint $table) {
17: $table->index('IdUser');
18: $table->index('IdTenant');
19: $table->index('UUID');
20: });
21:
22: Capsule::schema()->table('contacts_groups', function (Blueprint $table) {
23: $table->index('IdUser');
24: });
25:
26: Capsule::schema()->table('contacts_addressbooks', function (Blueprint $table) {
27: $table->index('UserId');
28: });
29:
30: Capsule::schema()->table('contacts_ctags', function (Blueprint $table) {
31: $table->index('UserId');
32: });
33: }
34:
35: /**
36: * Reverse the migrations.
37: *
38: * @return void
39: */
40: public function down()
41: {
42: Capsule::schema()->table('contacts', function (Blueprint $table) {
43: $table->dropIndex(['IdUser']);
44: $table->dropIndex(['IdTenant']);
45: $table->dropIndex(['UUID']);
46: });
47:
48: Capsule::schema()->table('contacts_groups', function (Blueprint $table) {
49: $table->dropIndex(['IdUser']);
50: });
51:
52: Capsule::schema()->table('contacts_addressbooks', function (Blueprint $table) {
53: $table->dropIndex(['UserId']);
54: });
55:
56: Capsule::schema()->table('contacts_ctags', function (Blueprint $table) {
57: $table->dropIndex(['UserId']);
58: });
59: }
60: }
61: