[eluser]malzahar[/eluser]
When creating database migrations is there really a difference between add_field and add_column. I know create_table is supposed to be used after add_field and conversely add_column is only for existing tables. So would there be a real difference between the following.
Code:
$fields = array(
'id' => array(
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment' => TRUE
),
'username' => array(
'type' => 'VARCHAR',
'constraint' => 40
),
'password' => array(
'type' => VARCHAR',
'constraint' => 60
)
);
$this->dbforge->add_field($fields);
$this->dbforge->create_table('users');
and
Code:
$this->dbforge->create_table('users');
$fields = array(
'id' => array(
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment' => TRUE
),
'username' => array(
'type' => 'VARCHAR',
'constraint' => 40
),
'password' => array(
'type' => VARCHAR',
'constraint' => 60
)
);
$this->dbforge->add_column('users', $fields);