這里會顯示出您選擇的修訂版和當前版本之間的差別。
兩側同時換到之前的修訂記錄 前一修訂版 后一修訂版 | 前一修訂版 | ||
en:razor:upgrade-instruction-v0-5-to-v0-6 [2015/03/18 14:29] cobub [1、Modify database] |
en:razor:upgrade-instruction-v0-5-to-v0-6 [2017/07/14 11:18] (當前版本) |
||
---|---|---|---|
行 1: | 行 1: | ||
+ | ~~Title:Cobub Razor Upgrade Instruction (v0.5 to v0.6) - Mobile Apps Marketing Platform of Open Source - Mobile Analytics & Mobile Push Notification Solutions - Cobub Mobile Developer Center~~ | ||
+ | {{description>Cobub Razor is an Open Source Mobile Analytics. When you are ready to upgrade Cobub Razor from version 0.5 to version 0.6, following steps is required:.}} | ||
+ | {{keywords>Cobub Razor,open source mobile analytics,mobile analytics,mobile app analytics, upgrade}} | ||
+ | |||
====== Upgrade Instruction (v0.5 to v0.6) ====== | ====== Upgrade Instruction (v0.5 to v0.6) ====== | ||
When you are ready to upgrade Cobub Razor from version 0.5 to version 0.6, following steps is required: | When you are ready to upgrade Cobub Razor from version 0.5 to version 0.6, following steps is required: | ||
行 4: | 行 8: | ||
1、Download the code of version 0.6 from https://github.com/cobub/razor , and you can get the razor-master.zip, unzip it to get razor-master folder, which contains the sdk and web folders. | 1、Download the code of version 0.6 from https://github.com/cobub/razor , and you can get the razor-master.zip, unzip it to get razor-master folder, which contains the sdk and web folders. | ||
- | 2、Copy the **web** folder to the directory of your web site where you are ready to upgrade Cobub Razor (Note: web can not be the same name with Cobub Razor’s name of V0.4 or V0.5 ). To facilitate debugging, you can rename ”web” to “razor_v6“, and set the $ config ['base_url'] value to the ‘http://192.168.1.103/razor_v6 ‘ in **config.php** which is under the **application** folder. | + | 2、Copy the **web** folder to the directory of your web site where you are ready to upgrade Cobub Razor (Note: web can not be the same name with Cobub Razor’s name of V0.4 or V0.5 ). To facilitate debugging, you can rename ”web” to “razor_v6“, and set the $ config ['base_url'] value to the ‘http://yoururl/razor_v6 ‘ in **config.php** which is under the **application** folder. |
3、Copy the **autoload.php** and **database.php** of V0.5 under the directory of **application\config\** to the diretory of **application\config\** of V0.6, override these two files of V0.6, and replace $route['default_controller'] = “install/installation” to $route['default_controller'] = “report/home” of V0.6 in **routes.php**. | 3、Copy the **autoload.php** and **database.php** of V0.5 under the directory of **application\config\** to the diretory of **application\config\** of V0.6, override these two files of V0.6, and replace $route['default_controller'] = “install/installation” to $route['default_controller'] = “report/home” of V0.6 in **routes.php**. | ||
行 102: | 行 106: | ||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;</code> | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;</code> | ||
+ | ==== 2、Modify the data warehouse ==== | ||
+ | === 2.1、Add tables === | ||
+ | |||
+ | |||
+ | == 1)sum_reserveusers_daily == | ||
+ | ^property name ^property value ^index^ | ||
+ | |rid |int(11) NOT NULL AUTO_INCREMENT |PRIMARY KEY| | ||
+ | |startdate_sk |int(11) NOT NULL|| | | ||
+ | |enddate_sk |int(11) NOT NULL| | | ||
+ | |product_id |int(11) NOT NULL| | | ||
+ | |version_name |varchar(128) NOT NULL| | | ||
+ | |channel_name |varchar(128) NOT NULL| | | ||
+ | |usercount |int(11) NOT NULL DEFAULT 0| | ||
+ | |day1 |int(11) NOT NULL DEFAULT 0| | | ||
+ | |day2 |int(11) NOT NULL DEFAULT 0| | | ||
+ | |day3 |int(11) NOT NULL DEFAULT 0| | | ||
+ | |day4 |int(11) NOT NULL DEFAULT 0| | | ||
+ | |day5 |int(11) NOT NULL DEFAULT 0| | | ||
+ | |day6 |int(11) NOT NULL DEFAULT 0| | | ||
+ | |day7 |int(11) NOT NULL DEFAULT 0| | | ||
+ | |day8 |int(11) NOT NULL DEFAULT 0| | | ||
+ | |||
+ | Unique key: | ||
+ | UNIQUE KEY `startdate_sk` (`startdate_sk`, `enddate_sk`, `product_id`, `version_name`, `channel_name`) | ||
+ | |||
+ | sql: | ||
+ | |||
+ | <code> | ||
+ | CREATE TABLE `razordw.umsinstall_sum_reserveusers_daily` ( | ||
+ | `rid` int(11) NOT NULL AUTO_INCREMENT, | ||
+ | `startdate_sk` int(11) NOT NULL, | ||
+ | `enddate_sk` int(11) NOT NULL, | ||
+ | `product_id` int(11) NOT NULL, | ||
+ | `version_name` varchar(128) NOT NULL, | ||
+ | `channel_name` varchar(128) NOT NULL, | ||
+ | `usercount` int(11) NOT NULL DEFAULT 0, | ||
+ | `day1` int(11) NOT NULL DEFAULT 0, | ||
+ | `day2` int(11) NOT NULL DEFAULT 0, | ||
+ | `day3` int(11) NOT NULL DEFAULT 0, | ||
+ | `day4` int(11) NOT NULL DEFAULT 0, | ||
+ | `day5` int(11) NOT NULL DEFAULT 0, | ||
+ | `day6` int(11) NOT NULL DEFAULT 0, | ||
+ | `day7` int(11) NOT NULL DEFAULT 0, | ||
+ | `day8` int(11) NOT NULL DEFAULT 0, | ||
+ | PRIMARY KEY (`rid`), | ||
+ | UNIQUE KEY `startdate_sk` (`startdate_sk`,`enddate_sk`,`product_id`,`version_name`,`channel_name`) | ||
+ | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
+ | </code> | ||
+ | === 2.2、Modify tables === | ||
+ | |||
+ | == 1) fact_event == | ||
+ | ^property name ^property value ^changes^ | ||
+ | |deviceid |varchar(50) |NOT NULL -> DEFAULT NULL| | ||
+ | |category |varchar(50) |NOT NULL -> DEFAULT NULL| | ||
+ | |label |varchar(50) |NOT NULL -> DEFAULT NULL| | ||
+ | |attachment |varchar(50) |NOT NULL -> DEFAULT NULL| | ||
+ | sql: | ||
+ | <code> | ||
+ | ALTER TABLE `razordw.umsinstall_fact_event` CHANGE `deviceid` `deviceid` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL; | ||
+ | </code> | ||
+ | Note: Other columns are similar. | ||
+ | == 2)log == | ||
+ | ^property name ^property value ^changes^ | ||
+ | |op_date |datetime |NOT NULL -> DEFAULT NULL| | ||
+ | |affected_rows |int(11) |NOT NULL -> DEFAULT NULL| | ||
+ | |duration |int(11) |NOT NULL -> DEFAULT NULL| | ||
+ | sql: | ||
+ | <code> | ||
+ | ALTER TABLE `razordw.umsinstall_log` CHANGE `op_date` `op_date` datetime DEFAULT NULL; | ||
+ | </code> | ||
+ | |||
+ | Note: Other columns are similar. | ||
+ | |||
+ | add: | ||
+ | |||
+ | property name:op_starttime | ||
+ | |||
+ | property value:datetime DEFAULT NULL | ||
+ | |||
+ | sql: | ||
+ | <code> | ||
+ | ALTER TABLE `razordw.umsinstall_log` ADD COLUMN `op_starttime` datetime DEFAULT NULL; | ||
+ | </code> | ||
+ | |||
+ | == 3)fact_reserveusers_monthly == | ||
+ | Rename ‘**fact_reserveusers_monthly**’ to ‘**sum_reserveusers_monthly**`; | ||
+ | |||
+ | sql: | ||
+ | <code> | ||
+ | RENAME TABLE `razordw.umsinstall_fact_reserveusers_monthly` TO `razordw.umsinstall_sum_reserveusers_monthly`; | ||
+ | </code> | ||
+ | |||
+ | add: | ||
+ | |||
+ | property name:channel_name | ||
+ | |||
+ | property value:varchar(128) NOT NULL | ||
+ | |||
+ | sql: | ||
+ | <code>ALTER TABLE `razordw.umsinstall_sum_reserveusers_monthly` ADD COLUMN `channel_name` varchar(128) NOT NULL;</code> | ||
+ | |||
+ | modify unique key: | ||
+ | change UNIQUE KEY `startdate_sk` (`startdate_sk`,`enddate_sk`,`product_id`,`version_name`) | ||
+ | to UNIQUE KEY `startdate_sk` (`startdate_sk`,`enddate_sk`,`product_id`,`version_name`,`channel_name`). | ||
+ | |||
+ | sql: | ||
+ | <code>ALTER TABLE `razordw.umsinstall_sum_reserveusers_monthly` ADD UNIQUE( `startdate_sk`, `enddate_sk`, `product_id`, `version_name`, `channel_name`);</code> | ||
+ | |||
+ | |||
+ | == 4)fact_reserveusers_weekly == | ||
+ | |||
+ | Rename ‘**fact_reserveusers_weekly**’ to ‘**sum_reserveusers_weekly**’. | ||
+ | |||
+ | sql: | ||
+ | <code>RENAME TABLE `razordw.umsinstall_fact_reserveusers_weekly` TO `razordw.umsinstall_sum_reserveusers_weekly`;</code> | ||
+ | |||
+ | add: | ||
+ | property name:channel_name | ||
+ | |||
+ | property value:varchar(128) NOT NULL | ||
+ | sql: | ||
+ | <code>ALTER TABLE `razordw.umsinstall_sum_reserveusers_weekly` ADD COLUMN `channel_name` varchar(128) NOT NULL; | ||
+ | </code> | ||
+ | change UNIQUE KEY `startdate_sk` (`startdate_sk`,`enddate_sk`,`product_id`,`version_name`) | ||
+ | to UNIQUE KEY `startdate_sk` (`startdate_sk`,`enddate_sk`,`product_id`,`version_name`,`channel_name`). | ||
+ | |||
+ | sql: | ||
+ | <code>ALTER TABLE `razordw.umsinstall_sum_reserveusers_weekly` ADD UNIQUE( `startdate_sk`, `enddate_sk`, `product_id`, `version_name`, `channel_name`);</code> | ||
+ | ==== 3、Modify the stored procedures ==== | ||
+ | |||
+ | |||
+ | Stored procedures: **rundaily** 、 **rundim** 、 **runfact** 、 **runmonthly** 、 **runsum** and **runweekly** 。 | ||
+ | |||
+ | Steps: | ||
+ | |||
+ | 1)you will get six sql script files under the directory of **assets\sql** of V0.6 : **sp_rundaily.sql** 、 **sp_rundim.sql** 、 **sp_runfact.sql** 、 **sp_runmonthly.sql** 、 **sp_runsum.sql** | ||
+ | and **sp_runweekly.sql**. | ||
+ | |||
+ | 2) modify table prefix | ||
+ | |||
+ | Modify the **umsinstall_** in all sql scirpt files above to your own data warehouse’s table prefix, for example,your data warehouse table prefix “razordw_”; | ||
+ | Replace the “databaseprefix.umsdatainstall_” to “database.database’s table prefix”, for example, your database is cobubrazor,and database’s table prefix is razor_,the ”databaseprefix.umsdatainstall_” should be “cobubrazor.razor_“. | ||
===== Step three: stop inserting data to database and pause the stored procedures. ===== | ===== Step three: stop inserting data to database and pause the stored procedures. ===== | ||
行 127: | 行 273: | ||
Backup the directory of the previous web site(e.g **web**,which is the root directory of version 0.5),store it in a suitable place and named web-backup0.5, then delete **web**. | Backup the directory of the previous web site(e.g **web**,which is the root directory of version 0.5),store it in a suitable place and named web-backup0.5, then delete **web**. | ||
- | Change”razor_v6” to “web”(the name of V0.5),and set $config['base_url']= ‘http://192.168.1.103/web’ in **config.php**. | + | Change”razor_v6” to “web”(the name of V0.5),and set $config['base_url']= ‘http://yoururl/web’ in **config.php**. |