Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
2.27% covered (danger)
2.27%
1 / 44
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
CreateNotificationAuditLogTable
2.27% covered (danger)
2.27%
1 / 44
50.00% covered (danger)
50.00%
1 / 2
5.73
0.00% covered (danger)
0.00%
0 / 1
 up
0.00% covered (danger)
0.00%
0 / 43
0.00% covered (danger)
0.00%
0 / 1
2
 down
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Database\Migrations;
4
5use CodeIgniter\Database\Migration;
6
7class CreateNotificationAuditLogTable extends Migration
8{
9    public function up()
10    {
11        $this->forge->addField([
12            'id' => [
13                'type' => 'INT',
14                'constraint' => 11,
15                'auto_increment' => true,
16            ],
17
18            'notification_id' => [
19                'type' => 'INT',
20                'constraint' => 11,
21                'null' => false,
22            ],
23
24            'provider' => [
25                'type' => 'VARCHAR',
26                'constraint' => 50,
27            ],
28
29            'request' => [
30                'type' => 'JSON',
31                'null' => true,
32            ],
33
34            'response' => [
35                'type' => 'JSON',
36                'null' => true,
37            ],
38
39            'status' => [
40                'type' => 'VARCHAR',
41                'constraint' => 30,
42                'default' => 'sent',
43            ],
44
45            'latency_ms' => [
46                'type' => 'INT',
47                'constraint' => 11,
48                'null' => true,
49            ],
50
51            'created_at' => [
52                'type' => 'DATETIME',
53                'null' => true,
54            ],
55        ]);
56
57        $this->forge->addKey('id', true);
58        $this->forge->addKey('provider');
59        $this->forge->addKey(['notification_id', 'created_at']);
60        $this->forge->addKey('status');
61
62        $this->forge->createTable('notification_audit_log');
63    }
64
65    public function down()
66    {
67        $this->forge->dropTable('notification_audit_log');
68    }
69}