Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
1.56% |
1 / 64 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| CreateNotificationDraftTable | |
1.56% |
1 / 64 |
|
50.00% |
1 / 2 |
5.82 | |
0.00% |
0 / 1 |
| up | |
0.00% |
0 / 63 |
|
0.00% |
0 / 1 |
2 | |||
| down | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Database\Migrations; |
| 4 | |
| 5 | use CodeIgniter\Database\Migration; |
| 6 | |
| 7 | class CreateNotificationDraftTable extends Migration |
| 8 | { |
| 9 | public function up() |
| 10 | { |
| 11 | $this->forge->addField([ |
| 12 | 'id' => [ |
| 13 | 'type' => 'BIGINT', |
| 14 | 'constraint' => 20, |
| 15 | 'unsigned' => true, |
| 16 | 'auto_increment' => true, |
| 17 | ], |
| 18 | |
| 19 | 'user_id' => [ |
| 20 | 'type' => 'BIGINT', |
| 21 | 'constraint' => 20, |
| 22 | 'null' => true, |
| 23 | ], |
| 24 | |
| 25 | 'contact_id' => [ |
| 26 | 'type' => 'BIGINT', |
| 27 | 'constraint' => 20, |
| 28 | 'null' => true, |
| 29 | ], |
| 30 | |
| 31 | 'channel' => [ |
| 32 | 'type' => 'VARCHAR', |
| 33 | 'constraint' => 30, |
| 34 | ], |
| 35 | |
| 36 | 'sender_id' => [ |
| 37 | 'type' => 'BIGINT', |
| 38 | 'constraint' => 20, |
| 39 | 'null' => true, |
| 40 | ], |
| 41 | |
| 42 | 'subject' => [ |
| 43 | 'type' => 'VARCHAR', |
| 44 | 'constraint' => 255, |
| 45 | 'null' => true, |
| 46 | ], |
| 47 | |
| 48 | 'message' => [ |
| 49 | 'type' => 'TEXT', |
| 50 | 'null' => true, |
| 51 | ], |
| 52 | |
| 53 | 'payload' => [ |
| 54 | 'type' => 'JSON', |
| 55 | 'null' => true, |
| 56 | ], |
| 57 | |
| 58 | 'scheduled_at' => [ |
| 59 | 'type' => 'DATETIME', |
| 60 | 'null' => true, |
| 61 | ], |
| 62 | |
| 63 | 'status' => [ |
| 64 | 'type' => 'VARCHAR', |
| 65 | 'constraint' => 20, |
| 66 | 'default' => 'draft', |
| 67 | ], |
| 68 | |
| 69 | 'created_at' => [ |
| 70 | 'type' => 'DATETIME', |
| 71 | 'null' => true, |
| 72 | ], |
| 73 | |
| 74 | 'updated_at' => [ |
| 75 | 'type' => 'DATETIME', |
| 76 | 'null' => true, |
| 77 | ], |
| 78 | ]); |
| 79 | |
| 80 | $this->forge->addKey('id', true); |
| 81 | |
| 82 | $this->forge->addKey(['contact_id']); |
| 83 | $this->forge->addKey(['user_id']); |
| 84 | $this->forge->addKey(['channel']); |
| 85 | $this->forge->addKey(['status']); |
| 86 | |
| 87 | $this->forge->createTable('notification_draft', true); |
| 88 | } |
| 89 | |
| 90 | public function down() |
| 91 | { |
| 92 | $this->forge->dropTable('notification_draft', true); |
| 93 | } |
| 94 | } |