/** * Generate the test data, which is basically a DB dump * with data only, and commit it to SVN repo * * @return void * */ private function generateTestData() { $this->sql_engine->generateTestData(CodePax_DbVersioning_Files_Manager::getTestDataFile()); // commit the new test data if (defined('SVN_USER') || VERSIONING === 'SVN') { $svn_wrapper = new CodePax_Scm_Svn(SCM_USER, SCM_PASS, REPO_URL, PROJECT_DIR); $svn_wrapper->commit("Codepax generated test data file", DB_VERSIONING_DIR); } else { if (VERSIONING === 'GIT') { $git_wrapper = new CodePax_Scm_Git(SCM_USER, SCM_PASS, REPO_URL, PROJECT_DIR); $git_wrapper->addAndCommit("Codepax generated test data file", DB_VERSIONING_DIR); $git_wrapper->push(); } } }
/** * Generates a baseline * * This method is called outside the * overall versioning process * * @return void * */ public function generateBaseline() { // get the new version number $baseline_version = $this->latest_db_version == '0.0.0' ? '1.0.0' : $this->incrementVersionNumber($this->latest_db_version); // generate baseline path $baseline_absolute_path = CodePax_DbVersioning_Files_Manager::getPathToBaselines() . DIRECTORY_SEPARATOR . $baseline_version . CodePax_DbVersioning_Files_Manager::SQL_FILE_EXTENSION; // factory the SQL engine object and generate baseline file $this->sql_engine->generateBaseline($baseline_absolute_path); // register baseline to DB $this->db_versions_model->addVersion($baseline_version, CodePax_DbVersions::TYPE_BASELINE); // commit the new baseline and versioning DB $svn_wrapper = new CodePax_Scm_Svn(SCM_USER, SCM_PASS, REPO_URL, PROJECT_DIR); $svn_wrapper->addAndCommit("SVN GUI generated baseline at version {$baseline_version}", DB_VERSIONING_DIR); }