Example #1
0
 /**
  * Shortcut for adding foreign keys
  * 
  * @param Varien_Db_Ddl_Table $table
  * @param Varien_Db_Ddl_Table|string $refTable
  * @param string $columnName
  * @return Mzax_Emarketing_Model_Resource_Setup
  */
 public function addForeignKey(Varien_Db_Ddl_Table $table, $refTable, $columnName)
 {
     if ($refTable instanceof Varien_Db_Ddl_Table) {
         $refTable = $refTable->getName();
     } else {
         $refTable = $this->getTable($refTable);
     }
     $fkName = $this->getFkName($table->getName(), $columnName, $refTable, $columnName);
     $table->addForeignKey($fkName, $columnName, $refTable, $columnName, Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE);
     return $this;
 }
Example #2
0
<?php

$this->startSetup();
/**
 * Note: there are many ways in Magento to achieve the same result below
 * of creating a database table. For this tutorial we have gone with the 
 * Varien_Db_Ddl_Table method but feel free to explore what Magento do in
 * CE 1.8.0.0 and ealier versions if you are interested.
 */
$table = new Varien_Db_Ddl_Table();
/**
 * This is an alias to the real name of our database table, which is 
 * configured in config.xml. By using an alias we can reference the same
 * table throughout our code if we wish and if the table name ever had to 
 * change we could simply update a single location, config.xml
 * - jc_newsview is the model alias
 * - news is the table reference
 */
$table->setName($this->getTable('jc_newsview/news'));
/**
 * Add the columns we need for now. If you need more in the future you can
 * always create a new setup script as an upgrade, we will introduce that 
 * later on in the tutorial.
 */
$table->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('auto_increment' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true));
$table->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table->addColumn('title', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table->addColumn('summary', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => false));
$table->addColumn('content', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => false));
/**
Example #3
0
 /**
  * Retrieve table options definition array for create table
  *
  * @param Varien_Db_Ddl_Table $table
  * @return array
  * @throws Zend_Db_Exception
  */
 protected function _getOptionsDefinition(Varien_Db_Ddl_Table $table)
 {
     $definition = array();
     $comment = $table->getComment();
     if (empty($comment)) {
         throw new Zend_Db_Exception('Comment for table is required and must be defined');
     }
     $definition[] = $this->quoteInto('COMMENT=?', $comment);
     $tableProps = array('type' => 'ENGINE=%s', 'checksum' => 'CHECKSUM=%d', 'auto_increment' => 'AUTO_INCREMENT=%d', 'avg_row_length' => 'AVG_ROW_LENGTH=%d', 'max_rows' => 'MAX_ROWS=%d', 'min_rows' => 'MIN_ROWS=%d', 'delay_key_write' => 'DELAY_KEY_WRITE=%d', 'row_format' => 'row_format=%s', 'charset' => 'charset=%s', 'collate' => 'COLLATE=%s');
     foreach ($tableProps as $key => $mask) {
         $v = $table->getOption($key);
         if ($v !== null) {
             $definition[] = sprintf($mask, $v);
         }
     }
     return $definition;
 }
Example #4
0
<?php

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer->startSetup();
$table = new Varien_Db_Ddl_Table();
$table->setName($this->getTable('admin/user'));
$table->addColumn('manager_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('unsigned' => true, 'nullable' => false, 'default' => "0"));
//ALTER TABLE admin_user ADD manager_id INT NOT NULL DEFAULT 0 AFTER password;
$installer->endSetup();
Example #5
0
 /**
  * Retrieve table options definition array for create table
  *
  * @param Varien_Db_Ddl_Table $table
  * @return array
  */
 protected function _getOptionsDefination(Varien_Db_Ddl_Table $table)
 {
     $definition = array();
     $tableProps = array('type' => 'ENGINE=%s', 'checksum' => 'CHECKSUM=%d', 'auto_increment' => 'AUTO_INCREMENT=%d', 'avg_row_length' => 'AVG_ROW_LENGTH=%d', 'comment' => 'COMMENT=\'%s\'', 'max_rows' => 'MAX_ROWS=%d', 'min_rows' => 'MIN_ROWS=%d', 'delay_key_write' => 'DELAY_KEY_WRITE=%d', 'row_format' => 'row_format=%s', 'charset' => 'charset=%s', 'collate' => 'COLLATE=%s');
     foreach ($tableProps as $key => $mask) {
         $v = $table->getOption($key);
         if (!is_null($v)) {
             $definition[] = sprintf($mask, $v);
         }
     }
     return $definition;
 }
<?php

$this->startSetup();
/**
 * Note: there are many ways in Magento to achieve the same result below
 * of creating a database table. For this tutorial we have gone with the 
 * Varien_Db_Ddl_Table method but feel free to explore what Magento do in
 * CE 1.8.0.0 and ealier versions if you are interested.
 */
$table = new Varien_Db_Ddl_Table();
/**
 * This is an alias to the real name of our database table, which is 
 * configured in config.xml. By using an alias we can reference the same
 * table throughout our code if we wish and if the table name ever had to 
 * change we could simply update a single location, config.xml
 * - abhishek_mymodule is the model alias
 * - staff is the table reference
 */
$table->setName($this->getTable('abhishek_mymodule/staff'));
/**
 * Add the columns we need for now. If you need more in the future you can
 * always create a new setup script as an upgrade, we will introduce that 
 * later on in the tutorial.
 */
$table->addColumn('staff_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('auto_increment' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true));
$table->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table->addColumn('code', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => false));
$table->addColumn('visibility', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('nullable' => false));
<?php

$this->startSetup();
$table1 = new Varien_Db_Ddl_Table();
$table1->setName($this->getTable('ultimatenewmedia_social/likes'));
$table1->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('auto_increment' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true));
$table1->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => false));
$table1->addColumn('ip_address', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table1->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table1->setOption('type', 'InnoDB');
$table1->setOption('charset', 'utf8');
$table2 = new Varien_Db_Ddl_Table();
$table2->setName($this->getTable('ultimatenewmedia_social/review'));
$table2->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('auto_increment' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true));
$table2->addColumn('review_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => false));
$table2->addColumn('ip_address', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table2->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table2->setOption('type', 'InnoDB');
$table2->setOption('charset', 'utf8');
$this->getConnection()->createTable($table1);
$this->getConnection()->createTable($table2);
$this->endSetup();
Example #8
0
<?php

$this->startSetup();
/**
* Note: there are many ways in Magento to achieve the same result of
* creating a database table. For this tutorial, we have gone with the
* Varien_Db_Ddl_Table method, but feel free to explore what Magento
* does in CE 1.9.0.1 and earlier versions.
*/
$table = new Varien_Db_Ddl_Table();
/**
* This is an alias of the real name of our database table, which is
* configured in config.xml. By using an alias, we can refer to the same
* table throughout our code if we wish, and if the table name ever has
* to change, we can simply update a single location, config.xml
* is the model alias is the table reference
*/
$table->setName($this->getTable('bhargav_accordion/accordion'));
/**
* Add the columns we need for now. If you need more later, you can
* always create a new setup script as an upgrade. We will introduce
* that later in this tutorial.
*/
$table->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('auto_increment' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true));
$table->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table->addColumn('title', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => false));
$table->addColumn('text', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => false));
$table->addColumn('visibility', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('nullable' => false));
$table->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_TEXT, 63, array('nullable' => true, 'default' => null));
$table->addColumn('page', Varien_Db_Ddl_Table::TYPE_TEXT, 63, array('nullable' => true, 'default' => null));
<?php

$this->startSetup();
$table = new Varien_Db_Ddl_Table();
$table->setName($this->getTable('omise_gateway/omise'));
$table->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true));
$table->addColumn('public_key', Varien_Db_Ddl_Table::TYPE_TEXT, 45, array('nullable' => true));
$table->addColumn('secret_key', Varien_Db_Ddl_Table::TYPE_TEXT, 45, array('nullable' => true));
$table->addColumn('public_key_test', Varien_Db_Ddl_Table::TYPE_TEXT, 45, array('nullable' => true));
$table->addColumn('secret_key_test', Varien_Db_Ddl_Table::TYPE_TEXT, 45, array('nullable' => true));
$table->addColumn('test_mode', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('default' => false));
$table->setOption('type', 'InnoDB');
$table->setOption('charset', 'utf8');
$this->getConnection()->createTable($table);
$this->endSetup();
<?php

/* @var $this Mage_Core_Model_Resource_Setup */
$this->startSetup();
$quotes = new Varien_Db_Ddl_Table();
$quotes->setName($this->getTable('guestcookies/quote'));
// Reference to foreign table
$quotes->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('primary' => true, 'nullable' => false, 'unsigned' => true));
$quotes->addForeignKey('FK_GUESTCOOKIES_QUOTE_ID_SALES_QUOTE_ENTITY_ID', 'quote_id', $this->getTable('sales/quote'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE);
// Token key to be stored in cookie
$quotes->addColumn('token', Varien_Db_Ddl_Table::TYPE_CHAR, 32, array('nullable' => false));
$quotes->addIndex('IDX_TOKEN', 'token', array('unique' => true));
$this->getConnection()->createTable($quotes);
$this->endSetup();
Example #11
0
$ipnTable->addColumn('invoice_time', Varien_Db_Ddl_Table::TYPE_INTEGER, 11);
$ipnTable->addColumn('expiration_time', Varien_Db_Ddl_Table::TYPE_INTEGER, 11);
$ipnTable->addColumn('current_time', Varien_Db_Ddl_Table::TYPE_INTEGER, 11);
$ipnTable->addColumn('pos_data', Varien_Db_Ddl_Table::TYPE_TEXT, 255);
$ipnTable->addColumn('btc_paid', Varien_Db_Ddl_Table::TYPE_DECIMAL, array(16, 8));
$ipnTable->addColumn('rate', Varien_Db_Ddl_Table::TYPE_DECIMAL, array(16, 8));
$ipnTable->addColumn('exception_status', Varien_Db_Ddl_Table::TYPE_TEXT, 255);
$ipnTable->setOption('type', 'InnoDB');
$ipnTable->setOption('charset', 'utf8');
$this->getConnection()->createTable($ipnTable);
/**
 * Table used to keep track of invoices that have been created. The
 * IPNs that are received are used to update this table.
 */
$this->run(sprintf('DROP TABLE IF EXISTS `%s`;', $this->getTable('bitpay/invoice')));
$invoiceTable = new Varien_Db_Ddl_Table();
$invoiceTable->setName($this->getTable('bitpay/invoice'));
$invoiceTable->addColumn('id', Varien_Db_Ddl_Table::TYPE_TEXT, 64, array('nullable' => false, 'primary' => true));
$invoiceTable->addColumn('quote_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11);
$invoiceTable->addColumn('increment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11);
$invoiceTable->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP);
$invoiceTable->addColumn('url', Varien_Db_Ddl_Table::TYPE_TEXT, 200);
$invoiceTable->addColumn('pos_data', Varien_Db_Ddl_Table::TYPE_TEXT, 255);
$invoiceTable->addColumn('status', Varien_Db_Ddl_Table::TYPE_TEXT, 20);
$invoiceTable->addColumn('btc_price', Varien_Db_Ddl_Table::TYPE_DECIMAL, array(16, 8));
$invoiceTable->addColumn('btc_due', Varien_Db_Ddl_Table::TYPE_DECIMAL, array(16, 8));
$invoiceTable->addColumn('price', Varien_Db_Ddl_Table::TYPE_DECIMAL, array(16, 8));
$invoiceTable->addColumn('currency', Varien_Db_Ddl_Table::TYPE_TEXT, 10);
$invoiceTable->addColumn('ex_rates', Varien_Db_Ddl_Table::TYPE_TEXT, 255);
$invoiceTable->addColumn('order_id', Varien_Db_Ddl_Table::TYPE_TEXT, 64);
$invoiceTable->addColumn('invoice_time', Varien_Db_Ddl_Table::TYPE_INTEGER, 11);
<?php

$this->startSetup();
$table = new Varien_Db_Ddl_Table();
$table->setName($this->getTable('jakey_resellblocker/basetime'));
$table->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('auto_increment' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true));
$table->addColumn('base_time', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table->addColumn('time_frame', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => false));
$table->setOption('type', 'InnoDB');
$table->setOption('charset', 'utf8');
$this->getConnection()->createTable($table);
//TABLE 2
$table2 = new Varien_Db_Ddl_Table();
$table2->setName($this->getTable('jakey_resellblocker/emaillist'));
$table2->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('auto_increment' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true));
$table2->addColumn('customer_email', Varien_Db_Ddl_Table::TYPE_VARCHAR, 30, array('nullable' => false));
$table2->addColumn('email_date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table2->addColumn('order_number', Varien_Db_Ddl_Table::TYPE_VARCHAR, 30, array('nullable' => false));
$table2->setOption('type', 'InnoDB');
$table2->setOption('charset', 'utf8');
$this->getConnection()->createTable($table2);
$this->endSetup();
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Mage
 * @package     Mage_GoogleShopping
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
$typesTable = new Varien_Db_Ddl_Table();
$typesTable->setName($this->getTable('googleshopping/types'))->addColumn('type_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => false, 'unsigned' => true, 'primary' => true))->addColumn('attribute_set_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5, array('unsigned' => true, 'nullable' => false))->addColumn('target_country', Varien_Db_Ddl_Table::TYPE_CHAR, 2, array('nullable' => false, 'default' => 'US'))->addForeignKey('GOOGLESHOPPING_TYPES_ATTRIBUTE_SET_ID', 'attribute_set_id', $this->getTable('eav/attribute_set'), 'attribute_set_id', Varien_Db_Ddl_Table::ACTION_CASCADE)->setOption('ENGINE', 'InnoDB')->setOption('DEFAULT CHARSET', 'utf8')->setOption('COMMENT', 'Google Content Item Types link Attribute Sets');
$itemsTable = new Varien_Db_Ddl_Table();
$itemsTable->setName($this->getTable('googleshopping/items'))->addColumn('item_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => false, 'unsigned' => true, 'primary' => true))->addColumn('type_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => false, 'unsigned' => true, 'default' => 0))->addColumn('product_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => false, 'unsigned' => true))->addColumn('gcontent_item_id', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false))->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5, array('nullable' => false, 'unsigned' => true))->addForeignKey('GOOGLESHOPPING_ITEMS_PRODUCT_ID', 'product_id', $this->getTable('catalog/product'), 'entity_id', Varien_Db_Ddl_Table::ACTION_CASCADE)->addForeignKey('GOOGLESHOPPING_ITEMS_STORE_ID', 'store_id', $this->getTable('core/store'), 'store_id', Varien_Db_Ddl_Table::ACTION_CASCADE)->setOption('ENGINE', 'InnoDB')->setOption('DEFAULT CHARSET', 'utf8')->setOption('COMMENT', 'Google Content Items Products');
$attributesTable = new Varien_Db_Ddl_Table();
$attributesTable->setName($this->getTable('googleshopping/attributes'))->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => false, 'unsigned' => true, 'primary' => true))->addColumn('attribute_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, 5, array('nullable' => false, 'unsigned' => true))->addColumn('gcontent_attribute', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false))->addColumn('type_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => false, 'unsigned' => true))->addForeignKey('GOOGLESHOPPING_ATTRIBUTES_ATTRIBUTE_ID', 'attribute_id', $this->getTable('eav/attribute'), 'attribute_id', Varien_Db_Ddl_Table::ACTION_CASCADE)->addForeignKey('GOOGLESHOPPING_ATTRIBUTES_TYPE_ID', 'type_id', $this->getTable('googleshopping/types'), 'type_id', Varien_Db_Ddl_Table::ACTION_CASCADE)->setOption('ENGINE', 'InnoDB')->setOption('DEFAULT CHARSET', 'utf8')->setOption('COMMENT', 'Google Content Attributes link Product Attributes');
$installer->startSetup();
$connection = $installer->getConnection();
$connection->createTable($typesTable);
$connection->modifyColumn($typesTable->getName(), 'type_id', 'int(10) unsigned NOT NULL auto_increment');
$connection->createTable($itemsTable);
$connection->modifyColumn($itemsTable->getName(), 'item_id', 'int(10) unsigned NOT NULL auto_increment');
$connection->addColumn($this->getTable('googleshopping/items'), 'published', 'DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00"');
$connection->addColumn($this->getTable('googleshopping/items'), 'expires', 'DATETIME NOT NULL DEFAULT "0000-00-00 00:00:00"');
$connection->createTable($attributesTable);
$connection->modifyColumn($attributesTable->getName(), 'id', 'int(10) unsigned NOT NULL auto_increment');
$installer->endSetup();
Example #14
0
<?php

$this->startSetup();
$table = new Varien_Db_Ddl_Table();
$table->setName($this->getTable('bluecom_branddirectory/brand'));
$table->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('auto_increment' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true));
$table->addColumn('create_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table->addColumn('update_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table->addColumn('name', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table->addColumn('url_key', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, null, array('nullable' => false));
$table->addColumn('visibility', Varien_Db_Ddl_Table::TYPE_BOOLEAN, null, array('nullable' => false));
$table->setOption('type', 'InnoDB');
$table->setOption('charset', 'utf8');
$this->getConnection()->createTable($table);
$this->endSetup();
<?php

$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
$installer->startSetup();
$tableName = $installer->getTable('ew_untranslatedstrings/string');
$table = new Varien_Db_Ddl_Table();
$table->setName($tableName);
$table->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array('nullable' => false, 'identity' => true, 'primary' => true));
$table->addColumn('store_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 11, array('nullable' => false));
$table->addColumn('untranslated_string', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table->addColumn('translation_code', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table->addColumn('translation_module', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => true));
$table->addColumn('locale', Varien_Db_Ddl_Table::TYPE_VARCHAR, 10, array('nullable' => true));
$table->addColumn('url_found', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => true));
$table->addColumn('date_found', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$installer->getConnection()->createTable($table);
$uniqueFields = array('store_id', 'untranslated_string', 'translation_code', 'locale');
$installer->getConnection()->addIndex($tableName, $installer->getIdxName($tableName, $uniqueFields, Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), $uniqueFields, Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE);
$installer->endSetup();
Example #16
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;
 }
Example #17
0
<?php

$this->startSetup();
/**
 * Note: there are many ways in Magento to achieve the same result below
 * of creating a database table. For this tutorial we have gone with the 
 * Varien_Db_Ddl_Table method but feel free to explore what Magento do in
 * CE 1.8.0.0 and ealier versions if you are interested.
 */
$table = new Varien_Db_Ddl_Table();
/**
 * This is an alias to the real name of our database table, which is 
 * configured in config.xml. By using an alias we can reference the same
 * table throughout our code if we wish and if the table name ever had to 
 * change we could simply update a single location, config.xml
 * - smashingmagazine_branddirectory is the model alias
 * - brand is the table reference
 */
$table->setName($this->getTable('infobitsolutions_managevendor/mapping'));
/**
 * Add the columns we need for now. If you need more in the future you can
 * always create a new setup script as an upgrade, we will introduce that 
 * later on in the tutorial.
 */
$table->addColumn('entity_id', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('auto_increment' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true));
$table->addColumn('vendor', Varien_Db_Ddl_Table::TYPE_INTEGER, 10, array('nullable' => false));
$table->addColumn('vendor_identifier', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table->addColumn('subdomain', Varien_Db_Ddl_Table::TYPE_VARCHAR, 255, array('nullable' => false));
$table->addColumn('created_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
$table->addColumn('updated_at', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array('nullable' => false));
/**