Is there a way to generate a field in fuel php that is an INT, that's also a primary key, not null, auto increment?
In the documentation it looks like:
php oil g scaffold <modelname> [<fieldname1>:<type1> |<fieldname2>:<type2> |..]
If I try something like:
oil g scaffold test testid:int primary key not null auto_increment
I get an error message of "undefined offset"
The ID gets generated automatically by oil scaffold so you don't have to type that. And after running the migration it will be created in the table as a primary key. If you want to change the migration after the scaffold is generated you can edit the migration file (fuel/app/migrations/..).
If you have for example
oil g scaffold test field:string field2:string
The migration will look something like this
namespace Fuel\Migrations;
class Create_tests
{
public function up()
{
\DBUtil::create_table('tests', array(
'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true),
'field' => array('constraint' => 255, 'type' => 'varchar'),
'field2' => array('constraint' => 255, 'type' => 'varchar'),
'created_at' => array('constraint' => 11, 'type' => 'int'),
'updated_at' => array('constraint' => 11, 'type' => 'int'),
), array('id'));
}
public function down()
{
\DBUtil::drop_table('tests');
}
}
Hope this helps.