refreshTableSchema() public method

This method cleans up cached table schema so that it can be re-created later to reflect the database schema change.
Since: 2.0.6
public refreshTableSchema ( string $name )
$name string table name.
Exemplo n.º 1
0
 /**
  * Refreshes the particular table schema.
  * This method cleans up cached table schema so that it can be re-created later
  * to reflect the database schema change.
  * @param string $name table name.
  * @since 2.0.6
  */
 public function refreshTableSchema($name)
 {
     try {
         $sql = "CALL ADMIN_CMD ('REORG TABLE " . $this->db->quoteTableName($name) . "')";
         $this->db->createCommand($sql)->execute();
     } catch (\Exception $ex) {
         // Do not throw error on table which doesn't exist
         if (!(isset($ex->errorInfo[1]) && $ex->errorInfo[1] === -2211)) {
             throw new \Exception($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
         }
     }
     parent::refreshTableSchema($name);
 }