用于CodeIgniter的DB模式迁移工具


DB schema migration tool for CodeIgniter

是否有一个很好的工具来管理MySQL模式的变化?可以单独使用,也可以与CodeIgniter框架集成。我有使用CakePHP的数据库迁移工具的经验,所以类似的东西会很好。

在其他Doctrine项目中有一个Doctrine迁移项目

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');
    }

从http://www.codeigniter.com/userguide2/libraries/migration.html查看