示例#1
0
 /**
  * Create database for grid columns
  * @param string $name
  * @param AW_Advancedreports_Block_Advanced_Grid $grid
  * @return AW_Advancedreports_Helper_Tools_Aggregator
  */
 private function _createFlatTable($name, $grid)
 {
     if ($grid) {
         $table = new Varien_Db_Ddl_Table();
         $table->setName($name);
         $periodKey = self::DATE_KEY_FIELD;
         $table->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_BIGINT, null, array('unsigned' => true, 'primary' => true, 'nullable' => false, 'identity' => true));
         $table->addColumn($periodKey, Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array('nullable' => false));
         foreach ($grid->getSetupColumns() as $column) {
             $index = $column->getIndex();
             $type = $column->getDdlType();
             $size = $column->getDdlSize();
             $options = $column->getDdlOptions();
             if ($index && $type) {
                 $table->addColumn($index, $type, $size, $options);
             }
         }
         $write = $this->_getWriteAdapter()->createTable($table);
     }
     return $this;
 }