Exemplo n.º 1
0
 public static function activate($id, $pluginType)
 {
     try {
         Am_Di::getInstance()->db->query("CREATE TABLE ?_notification (\n                notification_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n                content varchar(255),\n                url varchar(255),\n                is_blank TINYINT NOT NULL,\n                begin date NULL,\n                expire date NULL,\n                is_disabled TINYINT NOT NULL\n                ) CHARACTER SET utf8 COLLATE utf8_general_ci");
     } catch (Am_Exception_Db $e) {
     }
     try {
         Am_Di::getInstance()->db->query("CREATE TABLE ?_notification_access (\n                notification_access_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n                notification_id INT NOT NULL,\n                fn enum('product_id','product_category_id','free','user_id'),\n                id INT NULL\n                ) CHARACTER SET utf8 COLLATE utf8_general_ci");
     } catch (Am_Exception_Db $e) {
     }
     try {
         Am_Di::getInstance()->db->query("ALTER TABLE ?_notification\n                ADD `limit` TINYINT,\n                ADD is_custom TINYINT NOT NULL");
     } catch (Am_Exception_Db $e) {
     }
     try {
         Am_Di::getInstance()->db->query("ALTER TABLE ?_notification_access\n                MODIFY fn enum('product_id','product_category_id','free','user_id', 'user_group_id')");
     } catch (Am_Exception_Db $e) {
     }
     try {
         Am_Di::getInstance()->db->query("ALTER TABLE ?_notification\n                MODIFY content TEXT");
     } catch (Am_Exception_Db $e) {
     }
     try {
         Am_Di::getInstance()->db->query("ALTER TABLE ?_notification\n                ADD sort_order INT NOT NULL");
         Am_Di::getInstance()->db->query("SET @i = 0");
         Am_Di::getInstance()->db->query("UPDATE ?_notification SET sort_order=(@i:=@i+1) ORDER BY notification_id DESC");
     } catch (Am_Exception_Db $e) {
     }
     try {
         Am_Di::getInstance()->db->query("CREATE TABLE IF NOT EXISTS ?_notification_click (\n                notification_click_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n                notification_id INT NOT NULL,\n                user_id INT UNSIGNED NOT NULL,\n                dattm date NOT NULL,\n                INDEX notification_id (notification_id)\n            ) CHARACTER SET utf8 COLLATE utf8_general_ci");
     } catch (Am_Exception_Db $e) {
         //nop
     }
     return parent::activate($id, $pluginType);
 }
Exemplo n.º 2
0
 public static function activate($id, $pluginType)
 {
     try {
         Am_Di::getInstance()->db->query("CREATE TABLE ?_oto (\n                oto_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,\n                comment varchar(255),\n                conditions text,\n                view mediumtext,\n                product_id INT NOT NULL,\n                coupon_id INT NULL,\n                is_disabled TINYINT NOT NULL,\n                bp_id INT\n                ) CHARACTER SET utf8 COLLATE utf8_general_ci");
     } catch (Am_Exception_Db $e) {
     }
     return parent::activate($id, $pluginType);
 }