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 CreateContactsCardsTable extends Migration
8: {
9: /**
10: * Run the migrations.
11: *
12: * @return void
13: */
14: public function up()
15: {
16: Capsule::schema()->create('contacts_cards', function (Blueprint $table) {
17: $table->increments('Id');
18: $table->integer('CardId')->default(0);
19: $table->integer('AddressBookId')->default(0);
20: $table->string('FullName')->default('');
21: $table->integer('PrimaryEmail')->default(\Aurora\Modules\Contacts\Enums\PrimaryEmail::Personal);
22: $table->string('ViewEmail')->default('');
23: $table->string('FirstName')->default('');
24: $table->string('LastName')->default('');
25: $table->string('PersonalEmail')->default('');
26: $table->string('BusinessEmail')->default('');
27: $table->string('OtherEmail')->default('');
28: $table->string('BusinessCompany')->default('');
29: $table->integer('Frequency')->default(0);
30: $table->boolean('IsGroup')->default(false);
31:
32: $table->json('Properties')->nullable();
33: });
34:
35: $prefix = Capsule::connection()->getTablePrefix();
36:
37: Capsule::schema()->table('contacts_cards', function (Blueprint $table) use ($prefix) {
38: $table->index('CardId');
39: $table->index('AddressBookId');
40: $table->index('IsGroup');
41: $table->index('Frequency');
42:
43: Capsule::connection()->statement(
44: "CREATE FULLTEXT INDEX contacts_cards_fullname_index ON {$prefix}contacts_cards (FullName)"
45: );
46: Capsule::connection()->statement(
47: "CREATE FULLTEXT INDEX contacts_cards_viewemail_index ON {$prefix}contacts_cards (ViewEmail)"
48: );
49: Capsule::connection()->statement(
50: "CREATE FULLTEXT INDEX contacts_cards_personalemail_index ON {$prefix}contacts_cards (PersonalEmail)"
51: );
52: Capsule::connection()->statement(
53: "CREATE FULLTEXT INDEX contacts_cards_businessemail_index ON {$prefix}contacts_cards (BusinessEmail)"
54: );
55: Capsule::connection()->statement(
56: "CREATE FULLTEXT INDEX contacts_cards_businesscompany_index ON {$prefix}contacts_cards (BusinessCompany)"
57: );
58: Capsule::connection()->statement(
59: "CREATE FULLTEXT INDEX contacts_cards_otheremail_index ON {$prefix}contacts_cards (OtherEmail)"
60: );
61: });
62: }
63:
64: /**
65: * Reverse the migrations.
66: *
67: * @return void
68: */
69: public function down()
70: {
71: Capsule::schema()->dropIfExists('contacts_cards');
72: }
73: }
74: