Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Migration add primary key
#1

[eluser]nuclearmaker[/eluser]
how to add primary key in migration? i want to set blog_id as PRIMARY KEY

Code:
public function up()
{
$this->dbforge->add_field(array(
  'blog_id' => array(
   'type' => 'INT',
   'auto_increment' => TRUE
  ),
  'blog_title' => array(
   'type' => 'VARCHAR',
   'constraint' => '100',
  ),
  'blog_description' => array(
   'type' => 'TEXT',
   'null' => TRUE,
  ),
));

$this->dbforge->create_table('blog');
}




Theme © iAndrew 2016 - Forum software by © MyBB