Exemplo n.º 1
0
 public static function dropForeignKeys()
 {
     if (!self::$counter) {
         $resource = Mage::getModel('core/resource');
         $connection = $resource->getConnection('core_write');
         $FKscope = array('aw_sarp_subscription_items' => array('FK_SUBSCRIPTION_ID'), 'aw_sarp_sequence' => array('FK_SUBSCRIPTION_ID'), 'aw_sarp_payment_method_protx' => array('FK_sarp_subscription_protx'), 'aw_sarp_flat_subscriptions' => array('FK_FLAT_SUBSCRIPTION_ID'), 'aw_sarp_alert_events' => array('FK_ALERT_ID'));
         foreach ($FKscope as $table => $fks) {
             foreach ($fks as $fk) {
                 try {
                     $connection->exec(new Zend_Db_Expr("ALTER TABLE `{$table}` DROP FOREIGN KEY `{$fk}`"));
                     $connection->exec(new Zend_Db_Expr("ALTER TABLE `{$table}` DROP KEY `{$fk}`"));
                 } catch (Exception $e) {
                 }
             }
         }
         self::$counter = 1;
     }
 }
Exemplo n.º 2
0
 public function setup()
 {
     AW_Sarp_Test_Model_Mocks_Foreignresetter::dropForeignKeys();
     parent::setup();
 }