/**
  * Push
  *
  * @return Override database entity by current config file entity
  * @return Use {--show|yellow} to only display alter code
  */
 public function pushAction()
 {
     $name = $this->_model->getName();
     if ($this->_console->hasOption('show')) {
         echo $this->_model->generateSql();
     } else {
         if (!$this->_model->push()) {
             echo $name . $this->colorize(" - Not updated", 'red');
         } else {
             echo $name . $this->colorize(" - Updated", 'green');
         }
     }
 }
Example #2
0
 /**
  * Get config filepath
  *
  * @param DbSync_Model_AbstractModel $model
  * @throws Exception
  * @return string
  */
 public function getFilePath(DbSync_Model_AbstractModel $model)
 {
     switch (true) {
         case $model instanceof DbSync_Model_Table_Schema:
             $path = 'schema/' . $model->getTableName();
             break;
         case $model instanceof DbSync_Model_Table_Data:
             $path = 'data/' . $model->getTableName();
             break;
         case $model instanceof DbSync_Model_Table_Trigger:
             $path = 'trigger/' . $model->getTriggerName();
             break;
         default:
             throw new Exception("Model '" . get_class($model) . "' is not supported");
     }
     return $this->_path . '/' . $path . '.' . self::FILE_EXTENSION;
 }