【发布时间】:2012-08-15 11:31:20
【问题描述】:
我想更改codeigniter迁移的数据库连接。
我的默认数据库是 DB1,但我想更改与 DB2 的连接。
我该怎么做?默认编码如下。
defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_Add_blog extends CI_Migration {
public function up()
{
$this->dbforge->add_field(array(
'blog_id' => array(
'type' => 'INT',
'constraint' => 5,
'unsigned' => TRUE,
'auto_increment' => TRUE
),
'blog_title' => array(
'type' => 'VARCHAR',
'constraint' => '100',
),
'blog_description' => array(
'type' => 'TEXT',
'null' => TRUE,
),
));
$this->dbforge->create_table('blog');
}
public function down()
{
$this->dbforge->drop_table('blog');
}
【问题讨论】:
-
您使用的是什么版本的 CI?
标签: php codeigniter