@@ -47,13 +47,14 @@ migrations go in the **app/Database/Migrations/** directory and have names such
4747as *20121031100537_add_blog.php *.
4848::
4949
50- <?php namespace App\Database\Migrations;
50+ <?php
51+
52+ namespace App\Database\Migrations;
5153
5254 use CodeIgniter\Database\Migration;
5355
5456 class AddBlog extends Migration
5557 {
56-
5758 public function up()
5859 {
5960 $this->forge->addField([
@@ -64,12 +65,12 @@ as *20121031100537_add_blog.php*.
6465 'auto_increment' => true,
6566 ],
6667 'blog_title' => [
67- 'type' => 'VARCHAR',
68- 'constraint' => '100',
68+ 'type' => 'VARCHAR',
69+ 'constraint' => '100',
6970 ],
7071 'blog_description' => [
71- 'type' => 'TEXT',
72- 'null' => true,
72+ 'type' => 'TEXT',
73+ 'null' => true,
7374 ],
7475 ]);
7576 $this->forge->addKey('blog_id', true);
@@ -117,17 +118,25 @@ another database is used for mission critical data. You can ensure that migratio
117118against the proper group by setting the ``$DBGroup `` property on your migration. This name must
118119match the name of the database group exactly::
119120
120- <?php namespace App\Database\Migrations;
121+ <?php
122+
123+ namespace App\Database\Migrations;
121124
122125 use CodeIgniter\Database\Migration;
123126
124127 class AddBlog extends Migration
125128 {
126129 protected $DBGroup = 'alternate_db_group';
127130
128- public function up() { . . . }
131+ public function up()
132+ {
133+ // ...
134+ }
129135
130- public function down() { . . . }
136+ public function down()
137+ {
138+ // ...
139+ }
131140 }
132141
133142Namespaces
@@ -159,11 +168,12 @@ Usage Example
159168In this example some simple code is placed in **app/Controllers/Migrate.php **
160169to update the schema::
161170
162- <?php namespace App\Controllers;
171+ <?php
172+
173+ namespace App\Controllers;
163174
164175 class Migrate extends \CodeIgniter\Controller
165176 {
166-
167177 public function index()
168178 {
169179 $migrate = \Config\Services::migrations();
@@ -177,7 +187,6 @@ to update the schema::
177187 // Do something with the error here...
178188 }
179189 }
180-
181190 }
182191
183192*******************
0 commit comments