OIL scaffolding odd types
Closed this issue · 7 comments
oil generate scaffold email:string password:string displayname:string
generated a migration where 'email' had a validator for valid_email (expected outcome); however: displayname was set to type 'password' and has no validators (wtf?)
This is an invalid Oil command? What was the exact command you used, so we can debug it?
oil generate scaffold users email:string password:string displayname:string
was the command, and it generated a migration:
<?php
namespace Fuel\Migrations;
class Create_users
{
public function up()
{
\DBUtil::create_table('users', array(
'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true, 'unsigned' => true),
'email' => array('constraint' => 255, 'type' => 'varchar'),
'password' => array('constraint' => 255, 'type' => 'varchar'),
'displayname' => array('type' => 'password'), // funky line here
'created_at' => array('constraint' => 11, 'type' => 'int', 'null' => true),
'updated_at' => array('constraint' => 11, 'type' => 'int', 'null' => true),
), array('id'));
}
public function down()
{
\DBUtil::drop_table('users');
}
}
I'm clueless. I checked the code, but there isn't anything magical that would make type 'password'. When I run that exact same command here, I get
namespace Fuel\Migrations;
class Create_users
{
public function up()
{
\DBUtil::create_table('users', array(
'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true, 'unsigned' => true),
'email' => array('constraint' => 255, 'type' => 'varchar'),
'password' => array('constraint' => 255, 'type' => 'varchar'),
'displayname' => array('constraint' => 255, 'type' => 'varchar'),
'created_at' => array('constraint' => 11, 'type' => 'int', 'null' => true),
'updated_at' => array('constraint' => 11, 'type' => 'int', 'null' => true),
), array('id'));
}
public function down()
{
\DBUtil::drop_table('users');
}
Hmm, I'll try running it a few more times and see what happened. I was extremely confused when I saw it at first, especially anything that used the MySQL type "password".
I do wonder, does OIL under normal circumstances ever assign the type "password" ?
According to the code, not automatically. Unless you specify "fieldname:password" yourself.
Have you been able to look at this?
I can no longer reproduce this.