Archive for September 2019

Adding sql script to add column to existing d b table

filename: mysql4-upgrade-1.1.1-1.1.2.php <?php   $installer = $this; $installer->startSetup();   $connection = $installer->getConnection();   $tableName = $installer->getTable(’your_table_name’); $column = ‘newcolumn_id’; $comment = ‘Newcolumn ID’;   if (!$connection->tableColumnExists($tableName, $column)) { $connection->addColumn($tableName, $column, array( "type" => Varien_Db_Ddl_Table::TYPE_INTEGER, "nullable" => true, "length" => 10, "after" => "customer_id", "comment" => $comment )); }   $installer->endSetup();

Adding sql script to create database table

filename: mysql4-install-1.1.1.php <?php   $installer = $this; $installer->startSetup();   $tableName = $installer->getTable(’your_table_name’);   // Check if the table already exists if ($installer->getConnection()->isTableExists($tableName) != true) {   $table = $installer->getConnection() ->newTable($installer->getTable($tableName)) ->addColumn(’column_id’, Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( ‘identity’ => true, ‘unsigned’ => true, ‘nullable’ => false, ‘primary’ => true, ), ‘Email Stats Id’) ->addColumn(’customer_id’, Varien_Db_Ddl_Table::TYPE_INTEGER, null, array( ‘identity’ […]