1 | <?php namespace {namespace}\Database\Migrations; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
2 | |||
3 | use CodeIgniter\Database\Migration; |
||
4 | |||
5 | /** |
||
6 | * Short description of this class usages |
||
7 | * |
||
8 | * @class {name} |
||
9 | * @generated_by CI-Recharge |
||
10 | * @package {namespace} |
||
11 | * @extend Migration |
||
12 | * @created_at {created_at} |
||
13 | */ |
||
14 | |||
15 | class {name} extends Migration |
||
16 | { |
||
17 | public function up() |
||
18 | { |
||
19 | //disable Foreign Key Check |
||
20 | $this->db->disableForeignKeyChecks(); |
||
21 | |||
22 | $this->forge->addField([ |
||
23 | {attributes} |
||
24 | ]); |
||
25 | {keys} |
||
26 | $this->forge->createTable('{table}'); |
||
27 | |||
28 | //enable Foreign Key Check |
||
29 | $this->db->enableForeignKeyChecks(); |
||
30 | } |
||
31 | |||
32 | //-------------------------------------------------------------------- |
||
33 | |||
34 | public function down() |
||
35 | { |
||
36 | //disable Foreign Key Check |
||
37 | $this->db->disableForeignKeyChecks(); |
||
38 | |||
39 | $this->forge->dropTable('{table}'); |
||
40 | |||
41 | //enable Foreign Key Check |
||
42 | $this->db->enableForeignKeyChecks(); |
||
43 | } |
||
44 | } |
||
45 |