0

codeigniter migration のデータベース接続を変更したいと思います。

デフォルトのデータベースは 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');
}
4

2 に答える 2