Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
1.89% covered (danger)
1.89%
1 / 53
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
CreateNotificationCampaignTable
1.89% covered (danger)
1.89%
1 / 53
50.00% covered (danger)
50.00%
1 / 2
5.78
0.00% covered (danger)
0.00%
0 / 1
 up
0.00% covered (danger)
0.00%
0 / 52
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 CreateNotificationCampaignTable extends Migration
8{
9    public function up()
10    {
11        $this->forge->addField([
12            'id' => [
13                'type'           => 'INT',
14                'constraint'     => 11,
15                'unsigned'       => true,
16                'auto_increment' => true,
17            ],
18
19            'name' => [
20                'type'       => 'VARCHAR',
21                'constraint' => 255,
22            ],
23
24            'segment' => [
25                'type'       => 'VARCHAR',
26                'constraint' => 100,
27                'default'    => 'all',
28            ],
29
30            'channel' => [
31                'type'       => 'VARCHAR',
32                'constraint' => 50,
33            ],
34
35            'message' => [
36                'type' => 'TEXT',
37                'null' => true,
38            ],
39
40            'rule_ids' => [
41                'type' => 'TEXT',
42                'null' => true,
43            ],
44
45            'status' => [
46                'type'       => 'VARCHAR',
47                'constraint' => 50,
48                'default'    => 'draft',
49            ],
50
51            'scheduled_at' => [
52                'type' => 'DATETIME',
53                'null' => true,
54            ],
55
56            'created_at' => [
57                'type' => 'DATETIME',
58                'null' => true,
59            ],
60
61            'updated_at' => [
62                'type' => 'DATETIME',
63                'null' => true,
64            ],
65
66            'deleted_at' => [
67                'type' => 'DATETIME',
68                'null' => true,
69            ],
70        ]);
71
72        $this->forge->addKey('id', true);
73        $this->forge->createTable('notification_campaign');
74    }
75
76    public function down()
77    {
78        $this->forge->dropTable('notification_campaign');
79    }
80}