Пример #1
0
 public function testMigratorGoingDownDueToVersionTarget()
 {
     $dir = dirname(dirname(dirname(dirname(__FILE__)))) . '/fixtures/migrations/';
     Mad_Model_Migration_Migrator::up($dir, 1);
     Mad_Model_Migration_Migrator::down($dir, 0);
     $user = new User();
     $columns = $user->columnNames();
     $this->assertFalse(in_array('last_name', $columns));
     $e = null;
     try {
         $this->_conn->selectValues("SELECT * FROM reminders");
     } catch (Exception $e) {
     }
     $this->assertInstanceOf('Horde_Db_Exception', $e);
     Mad_Model_Migration_Migrator::up($dir);
     $user->resetColumnInformation();
     $columns = $user->columnNames();
     $this->assertTrue(in_array('last_name', $columns));
     $result = Reminder::create(array('content' => 'hello world', 'remind_at' => '2005-01-01 02:22:23'));
     $reminder = Reminder::find('first');
     $this->assertEquals('hello world', $reminder->content);
 }
Пример #2
0
 /**
  * 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);
 }