Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
2.70% |
1 / 37 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| CreateSystemSettingTable | |
2.70% |
1 / 37 |
|
50.00% |
1 / 2 |
5.68 | |
0.00% |
0 / 1 |
| up | |
0.00% |
0 / 36 |
|
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 CreateSystemSettingTable 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 | 'setting_key' => [ |
| 20 | 'type' => 'VARCHAR', |
| 21 | 'constraint' => 150, |
| 22 | ], |
| 23 | |
| 24 | 'setting_value' => [ |
| 25 | 'type' => 'TEXT', |
| 26 | 'null' => true, |
| 27 | ], |
| 28 | |
| 29 | 'type' => [ |
| 30 | 'type' => 'VARCHAR', |
| 31 | 'constraint' => 50, |
| 32 | 'default' => 'string', // string | bool | json | int |
| 33 | ], |
| 34 | |
| 35 | 'description' => [ |
| 36 | 'type' => 'TEXT', |
| 37 | 'null' => true, |
| 38 | ], |
| 39 | |
| 40 | 'created_at' => [ |
| 41 | 'type' => 'DATETIME', |
| 42 | 'null' => true, |
| 43 | ], |
| 44 | |
| 45 | 'updated_at' => [ |
| 46 | 'type' => 'DATETIME', |
| 47 | 'null' => true, |
| 48 | ], |
| 49 | ]); |
| 50 | |
| 51 | $this->forge->addKey('id', true); |
| 52 | $this->forge->addUniqueKey('setting_key'); |
| 53 | |
| 54 | $this->forge->createTable('system_setting'); |
| 55 | } |
| 56 | |
| 57 | public function down() |
| 58 | { |
| 59 | $this->forge->dropTable('system_setting'); |
| 60 | } |
| 61 | } |