obsidian/MyObsidianVault/Knowledgebase/WebDev/2 CodeIgniter/_Course Notes/02.) Migrations - Add entities.md
2024-12-22 14:02:54 +01:00

600 B

php spark make:scaffold Product

Creates Controller, Model, Migration, Seeder

//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");
php spark migrate:status

php spark migrate