CreateEmailLogTable::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateEmailLogTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create(config('email-log.table_name'), function (Blueprint $table) {
17
            $table->bigIncrements('id');
18
19
            $table->string('from');
20
            $table->string('to');
21
            $table->string('subject');
22
            $table->text('body');
23
24
            $table->string('provider')->nullable();
25
            $table->string('provider_email_id')->nullable();
26
27
            $table->unsignedBigInteger('recipient_id')->nullable();
28
            $table->string('recipient_type')->nullable();
29
30
            $table->timestamp('delivered_at')->nullable();
31
            $table->timestamp('failed_at')->nullable();
32
            $table->timestamp('opened_at')->nullable();
33
            $table->timestamp('clicked_at')->nullable();
34
            $table->timestamps();
35
36
            $table->index(['recipient_id', 'recipient_type'], 'recipient');
37
            $table->index(['provider', 'provider_email_id'], 'provider_email_id');
38
        });
39
    }
40
41
    /**
42
     * Reverse the migrations.
43
     *
44
     * @return void
45
     */
46
    public function down()
47
    {
48
        Schema::dropIfExists(config('email-log.table_name'));
49
    }
50
}
51