Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
2.00% |
1 / 50 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| CreateSendersTable | |
2.00% |
1 / 50 |
|
50.00% |
1 / 2 |
5.76 | |
0.00% |
0 / 1 |
| up | |
0.00% |
0 / 49 |
|
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 CreateSendersTable 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' => 150, |
| 22 | ], |
| 23 | |
| 24 | 'channel' => [ |
| 25 | 'type' => 'VARCHAR', |
| 26 | 'constraint' => 50, |
| 27 | 'null' => false, |
| 28 | ], |
| 29 | |
| 30 | 'provider_id' => [ |
| 31 | 'type' => 'INT', |
| 32 | 'constraint' => 11, |
| 33 | 'unsigned' => true, |
| 34 | ], |
| 35 | |
| 36 | 'value' => [ |
| 37 | 'type' => 'TEXT', |
| 38 | 'null' => false, |
| 39 | ], |
| 40 | |
| 41 | 'status' => [ |
| 42 | 'type' => 'TINYINT', |
| 43 | 'constraint' => 1, |
| 44 | 'default' => 1, |
| 45 | ], |
| 46 | |
| 47 | 'is_default' => [ |
| 48 | 'type' => 'TINYINT', |
| 49 | 'constraint' => 1, |
| 50 | 'default' => 0, |
| 51 | ], |
| 52 | |
| 53 | 'created_at' => [ |
| 54 | 'type' => 'DATETIME', |
| 55 | 'null' => true, |
| 56 | ], |
| 57 | |
| 58 | 'updated_at' => [ |
| 59 | 'type' => 'DATETIME', |
| 60 | 'null' => true, |
| 61 | ], |
| 62 | ]); |
| 63 | |
| 64 | // Primary key |
| 65 | $this->forge->addKey('id', true); |
| 66 | |
| 67 | // Index métier |
| 68 | $this->forge->addKey(['channel']); |
| 69 | $this->forge->addKey(['provider_id']); |
| 70 | $this->forge->addKey(['channel', 'provider_id']); |
| 71 | |
| 72 | $this->forge->createTable('sender', true); |
| 73 | } |
| 74 | |
| 75 | public function down() |
| 76 | { |
| 77 | $this->forge->dropTable('sender', true); |
| 78 | } |
| 79 | } |