startSetup(); /** * Drop indexes */ $installer->getConnection()->dropIndex( $installer->getTable('cron/schedule'), 'TASK_NAME' ); $installer->getConnection()->dropIndex( $installer->getTable('cron/schedule'), 'SCHEDULED_AT' ); /** * Change columns */ $tables = array( $installer->getTable('cron/schedule') => array( 'columns' => array( 'schedule_id' => array( 'type' => Varien_Db_Ddl_Table::TYPE_INTEGER, 'identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true, 'comment' => 'Schedule Id' ), 'job_code' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, 'length' => 255, 'nullable' => false, 'default' => '0', 'comment' => 'Job Code' ), 'status' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, 'length' => 7, 'nullable' => false, 'default' => 'pending', 'comment' => 'Status' ), 'messages' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TEXT, 'length' => '64K', 'comment' => 'Messages' ), 'created_at' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP, 'nullable' => false, 'comment' => 'Created At' ), 'scheduled_at' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP, 'comment' => 'Scheduled At' ), 'executed_at' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP, 'comment' => 'Executed At' ), 'finished_at' => array( 'type' => Varien_Db_Ddl_Table::TYPE_TIMESTAMP, 'comment' => 'Finished At' ) ), 'comment' => 'Cron Schedule' ) ); $installer->getConnection()->modifyTables($tables); /** * Add indexes */ $installer->getConnection()->addIndex( $installer->getTable('cron/schedule'), $installer->getIdxName('cron/schedule', array('job_code')), array('job_code') ); $installer->getConnection()->addIndex( $installer->getTable('cron/schedule'), $installer->getIdxName('cron/schedule', array('scheduled_at', 'status')), array('scheduled_at', 'status') ); $installer->endSetup();