up() public method

public up ( string $targetVersion = null )
$targetVersion string
Ejemplo n.º 1
0
 public static function setUpBeforeClass()
 {
     self::$callback = array(__CLASS__, 'getDb');
     parent::setUpBeforeClass();
     $migrator = new Horde_Db_Migration_Migrator($GLOBALS['injector']->getInstance('Horde_Db_Adapter'), null, array('migrationsPath' => __DIR__ . '/../../../../../../migration', 'schemaTableName' => 'kronolith_test_schema'));
     $migrator->up();
 }
Ejemplo n.º 2
0
 public static function setUpBeforeClass()
 {
     self::$callback = array(__CLASS__, 'getDb');
     parent::setUpBeforeClass();
     $migrator = new Horde_Db_Migration_Migrator($GLOBALS['injector']->getInstance('Horde_Db_Adapter'), null, array('migrationsPath' => __DIR__ . '/../../../../../../migration', 'schemaTableName' => 'kronolith_test_schema'));
     $migrator->up();
     list($share, $other_share) = self::_createDefaultShares();
     self::$driver = Kronolith::getDriver('Sql', $share->getName());
     self::$type = 'Sql';
 }
Ejemplo n.º 3
0
 /**
  * Create a connector to an in-memory sqlite DB.
  *
  * @param array $params Additional options.
  * <pre>
  * 'migrations' - (array) An list of migrations that should be run.
  *                Each element must contain the keys 'migrationsPath'
  *                and 'schemaTableName'.
  *                DEFAULT: empty
  * </pre>
  *
  * @return Horde_Db_Adapter_Pdo_Sqlite The DB adapter.
  */
 public function create($params = array())
 {
     if (!extension_loaded('pdo') || !in_array('sqlite', PDO::getAvailableDrivers())) {
         throw new Horde_Test_Exception('No sqlite extension or no sqlite PDO driver');
     }
     if (!class_exists('Horde_Db_Adapter_Pdo_Sqlite')) {
         throw new Horde_Test_Exception('The "Horde_Db_Adapter_Pdo_Sqlite" class is unavailable!');
     }
     $db = new Horde_Db_Adapter_Pdo_Sqlite(array('dbname' => ':memory:', 'charset' => 'utf-8'));
     if (isset($params['migrations'])) {
         if (isset($params['migrations']['migrationsPath'])) {
             $migrations = array($params['migrations']);
         } else {
             $migrations = $params['migrations'];
         }
         foreach ($migrations as $migration) {
             $migrator = new Horde_Db_Migration_Migrator($db, null, $migration);
             $migrator->up();
         }
     }
     return $db;
 }
Ejemplo n.º 4
0
 public function testWithDuplicates()
 {
     try {
         $dir = dirname(__DIR__) . '/fixtures/migrations_with_duplicate/';
         $migrator = new Horde_Db_Migration_Migrator($this->_conn, null, array('migrationsPath' => $dir));
         $migrator->up();
     } catch (Exception $e) {
         return;
     }
     $this->fail('Expected exception wasn\'t raised');
 }