CodeIgniter #7 Migrations

This commit is contained in:
Torsten 2024-11-11 08:59:41 +01:00
parent 20aa076bc4
commit fc9b532014

View file

@ -2,3 +2,24 @@
php spark make:scaffold Product
```
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");
```