/** * @param string $migrationsPath * @param string $targetVersion */ public static function down($migrationsPath, $targetVersion = null) { $mig = new Mad_Model_Migration_Migrator('down', $migrationsPath, $targetVersion); $mig->doMigrate(); }
public function testWithMissingVersionNumbers() { $dir = dirname(dirname(dirname(dirname(__FILE__)))) . '/fixtures/migrations_with_missing_versions/'; Mad_Model_Migration_Migrator::migrate($dir, 500); $this->assertEquals(4, Mad_Model_Migration_Migrator::getCurrentVersion()); Mad_Model_Migration_Migrator::migrate($dir, 2); $this->assertEquals(2, Mad_Model_Migration_Migrator::getCurrentVersion()); $e = null; try { $this->_conn->selectValues("SELECT * FROM reminders"); } catch (Exception $e) { } $this->assertInstanceOf('Horde_Db_Exception', $e); $user = new User(); $columns = $user->columnNames(); $this->assertTrue(in_array('last_name', $columns)); }
/** * Resets your database using your migrations for the current environment */ public function db_reset() { $path = MAD_ROOT . '/db/migrate/'; Mad_Model_Migration_Migrator::down($path, 0); Mad_Model_Migration_Migrator::up($path); }