CodeIgniter #7 Migrations
This commit is contained in:
parent
20aa076bc4
commit
fc9b532014
1 changed files with 21 additions and 0 deletions
|
|
@ -2,3 +2,24 @@
|
||||||
php spark make:scaffold Product
|
php spark make:scaffold Product
|
||||||
```
|
```
|
||||||
Creates Controller, Model, Migration, Seeder
|
Creates Controller, Model, Migration, Seeder
|
||||||
|
|
||||||
|
```php
|
||||||
|
//up:
|
||||||
|
$this->forge->addField((["id"=>
|
||||||
|
["type"=>"INT,
|
||||||
|
"constraint"=>5,
|
||||||
|
"auto increment" => true,
|
||||||
|
"unsigned" => true
|
||||||
|
],
|
||||||
|
"name" => ["type"=>"VARCHAR".
|
||||||
|
"constraint" => 120,
|
||||||
|
"null" => false
|
||||||
|
]
|
||||||
|
]
|
||||||
|
));
|
||||||
|
$this->forge->addPrimaryKey("id);
|
||||||
|
$this->forge->createTable("students");
|
||||||
|
|
||||||
|
//down:
|
||||||
|
$this->forge->dropTable("students");
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue