title: Yii check if db column exists before creating it
body: <p>I'm looking to check if a database column exists within a table before I create the column. I know this can be done easily using pure sql, but I would like to try to do it the Yii way using the db schema functions.</p>
  
  <p>This if statement below doesn't work cause there isn't a getColumn function, so using db->schema what else can be used to check whether the column ($model->VARNAME) exists?</p>
  
  <pre><code>if(!Yii::app()-&gt;db-&gt;schema-&gt;getColumn($form-&gt;TABLE_NAME, $model-&gt;VARNAME))
  {
      if($model-&gt;save())
      {
          Yii::app()-&gt;db-&gt;schema-&gt;addColumn($form-&gt;TABLE_NAME, $model-&gt;VARNAME, $column_t);
          $this-&gt;redirect(array('view','field'=&gt;$model-&gt;FIELD_ID));
      }
  }
  else
  {
      $model-&gt;addError('VARNAME','Column "'.$model-&gt;VARNAME.'" already exists. Please pick a new column name.');
  }
  </code></pre>