基于PHP数据库迁移工具 phpmig

jopen 12年前

这是一款为PHP定做的一款短小而精悍的数据库迁移工具;为多个项目的数据平稳迁移提供了很好的支持,根据个人使用情况感觉该工具简单适用(正是我们追求的cool的标准)

<?php    # phpmig.php    // do some autoloading of Doctrine here    use \Phpmig\Adapter,      \Phpmig\Pimple\Pimple,      \Doctrine\DBAL\DriverManager;    $container = new Pimple();    $container['db'] = $container->share(function() {      return DriverManager::getConnection(array(          'driver' => 'pdo_sqlite',          'path'   => __DIR__ . DIRECTORY_SEPARATOR . 'db.sqlite',      ));  });    $container['phpmig.adapter'] = $container->share(function() use ($container) {      return new Adapter\Doctrine\DBAL($container['db'], 'migrations');  });    $container['phpmig.migrations'] = function() {      return glob(__DIR__ . DIRECTORY_SEPARATOR . 'migrations/*.php');  };    return $container;

注:该工具依赖于开源社区另一个很cool的工具:composer(包依赖工具), 详细介绍可参见 http://getcomposer.org/


项目主页:http://www.open-open.com/lib/view/home/1347636966288