Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
2.00% covered (danger)
2.00%
1 / 50
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
CreateContactListIntegrationTable
2.00% covered (danger)
2.00%
1 / 50
50.00% covered (danger)
50.00%
1 / 2
5.76
0.00% covered (danger)
0.00%
0 / 1
 up
0.00% covered (danger)
0.00%
0 / 49
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 CreateContactListIntegrationTable extends Migration
8{
9    public function up()
10    {
11        $this->forge->addField([
12            'id' => [
13                'type' => 'INT',
14                'auto_increment' => true,
15                'unsigned' => true
16            ],
17
18            'contact_list_id' => [
19                'type' => 'BIGINT',
20                'constraint' => 20,
21                'unsigned' => true
22            ],
23
24            'type' => [
25                'type' => 'VARCHAR',
26                'constraint' => 50
27            ],
28
29            'provider' => [
30                'type' => 'VARCHAR',
31                'constraint' => 100,
32                'null' => true
33            ],
34
35            'is_active' => [
36                'type' => 'TINYINT',
37                'constraint' => 1,
38                'default' => 0
39            ],
40
41            'config' => [
42                'type' => 'JSON',
43                'null' => true
44            ],
45
46            'created_at' => [
47                'type' => 'DATETIME',
48                'null' => true
49            ],
50
51            'updated_at' => [
52                'type' => 'DATETIME',
53                'null' => true
54            ],
55        ]);
56
57        $this->forge->addKey('id', true);
58        $this->forge->addKey('contact_list_id');
59        $this->forge->addKey('type');
60
61        // FK (optionnel selon stratégie)
62        $this->forge->addForeignKey(
63            'contact_list_id',
64            'contact_list',
65            'id',
66            'CASCADE',
67            'CASCADE'
68        );
69
70        $this->forge->createTable('contact_list_integration', true);
71    }
72
73    public function down()
74    {
75        $this->forge->dropTable('contact_list_integration', true);
76    }
77}