コード例 #1
0
ファイル: Migration.php プロジェクト: reoring/sabel
 protected function _execMigration()
 {
     $version = $this->currentVersion;
     $to = (int) $this->migrateTo;
     if ((int) $version === $to) {
         $this->message("NO CHANGES FROM {$to}");
         exit;
     }
     $doNext = false;
     if ($version < $to) {
         $next = $version + 1;
         $num = $next;
         $mode = "upgrade";
         $doNext = $next < $to;
     } else {
         $next = $version - 1;
         $num = $version;
         $mode = "downgrade";
         $doNext = $next > $to;
     }
     Sabel_Db_Migration_Manager::setApplyMode($mode);
     $instance = Sabel_Db::createMigrator($this->connectionName);
     $directory = Sabel_Db_Migration_Manager::getDirectory();
     $instance->execute($directory . DS . $this->files[$num]);
     $this->updateVersionNumber($next);
     return $doNext;
 }
コード例 #2
0
ファイル: Migration.php プロジェクト: reoring/sabel
 protected function getRestoreFileName()
 {
     $directory = Sabel_Db_Migration_Manager::getDirectory();
     $dir = $directory . DIRECTORY_SEPARATOR . "restores";
     if (!is_dir($dir)) {
         mkdir($dir);
     }
     return $dir . DIRECTORY_SEPARATOR . "restore_" . $this->version . ".php";
 }