Add upgrade script 72/85172/4 accepted/tizen/common/20160831.161334 accepted/tizen/ivi/20160831.075845 accepted/tizen/mobile/20160831.075719 accepted/tizen/tv/20160831.075744 accepted/tizen/wearable/20160831.075814 submit/tizen/20160831.002039
authorWootak Jung <wootak.jung@samsung.com>
Wed, 24 Aug 2016 04:44:35 +0000 (13:44 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 24 Aug 2016 06:41:14 +0000 (15:41 +0900)
Change-Id: I3798481f7f06d5cdc1626445ae6a4f2983b2e674

CMakeLists.txt
packaging/tel-plugin-packetservice.spec
resources/dnet_db_upgrade_24_30.sh [new file with mode: 0644]
resources/dnet_db_upgrade_24_30.sql [new file with mode: 0644]

index da1b439..1b2e47c 100644 (file)
@@ -75,6 +75,8 @@ SET_TARGET_PROPERTIES(ps-plugin PROPERTIES PREFIX "" OUTPUT_NAME ps-plugin)
 
 # install
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/resources/dnet_db.sql DESTINATION ${DATAROOTDIR}/ps-plugin)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/resources/dnet_db_upgrade_24_30.sql DESTINATION ${DATAROOTDIR}/ps-plugin)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/resources/dnet_db_upgrade_24_30.sh DESTINATION ${DATAROOTDIR}/upgrade/scripts)
 INSTALL(FILES ${RES_DIR}/dnet_db_init.sql DESTINATION ${DATAROOTDIR}/ps-plugin)
 #INSTALL(FILES ${CMAKE_SOURCE_DIR}/resources/apns-conf.xml DESTINATION ${DATAROOTDIR}/ps-plugin)
 INSTALL(TARGETS ps-plugin LIBRARY DESTINATION ${LIBDIR}/telephony/plugins)
index 39c24f5..2e624b9 100644 (file)
@@ -1,6 +1,6 @@
 %define major 0
 %define minor 3
-%define patchlevel 29
+%define patchlevel 30
 
 Name:           tel-plugin-packetservice
 Version:        %{major}.%{minor}.%{patchlevel}
@@ -108,6 +108,8 @@ cp %{SOURCE1} %{buildroot}/etc/dbus-1/system.d/tel-plugin-ps.conf
 #%doc COPYING
 %{_datadir}/ps-plugin/dnet_db.sql
 %{_datadir}/ps-plugin/dnet_db_init.sql
+%{_datadir}/ps-plugin/dnet_db_upgrade_24_30.sql
+%{_datadir}/upgrade/scripts/dnet_db_upgrade_24_30.sh
 #%{_datadir}/ps-plugin/apns-conf.xml
 %{_libdir}/telephony/plugins/ps-plugin*
 %{_datadir}/license/tel-plugin-packetservice
diff --git a/resources/dnet_db_upgrade_24_30.sh b/resources/dnet_db_upgrade_24_30.sh
new file mode 100644 (file)
index 0000000..50355b2
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+/usr/bin/sqlite3 /opt/dbspace/.dnet.db < /usr/share/ps-plugin/dnet_db_upgrade_24_30.sql
+/usr/bin/sqlite3 /opt/dbspace/.dnet2.db < /usr/share/ps-plugin/dnet_db_upgrade_24_30.sql
+rm -f /usr/share/ps-plugin/dnet_db_upgrade_24_30.sql
+
+chown telephony:telephony /opt/dbspace/.dnet.db
+chown telephony:telephony /opt/dbspace/.dnet.db-journal
+chown telephony:telephony /opt/dbspace/.dnet2.db
+chown telephony:telephony /opt/dbspace/.dnet2.db-journal
+
+chsmack -a System /opt/dbspace/.dnet.db
+chsmack -a System /opt/dbspace/.dnet.db-journal
+chsmack -a System /opt/dbspace/.dnet2.db
+chsmack -a System /opt/dbspace/.dnet2.db-journal
diff --git a/resources/dnet_db_upgrade_24_30.sql b/resources/dnet_db_upgrade_24_30.sql
new file mode 100644 (file)
index 0000000..173dad6
--- /dev/null
@@ -0,0 +1,38 @@
+DROP TABLE IF EXISTS "pdp_profile_upgrade";
+CREATE TABLE pdp_profile_upgrade(
+       profile_id           INTEGER PRIMARY KEY,
+       profile_name         TEXT,
+       apn                  TEXT,
+       auth_type            INTEGER,
+       auth_id              TEXT,
+       auth_pwd             TEXT,
+       pdp_protocol         INTEGER,
+       roam_pdp_protocol    INTEGER,
+       proxy_ip_addr        TEXT,
+       home_url             TEXT,
+       linger_time          INTEGER,
+       traffic_class        INTEGER,
+       is_static_ip_addr    INTEGER,
+       ip_addr              TEXT,
+       is_static_dns_addr   INTEGER,
+       dns_addr1            TEXT,
+       dns_addr2            TEXT,
+       network_info_id      INTEGER,
+       svc_category_id      INTEGER,
+       hidden               INTEGER,
+       editable             INTEGER,
+       default_internet_con INTEGER,
+       user_defined         INTEGER,
+       is_roaming_apn       INTEGER,
+       profile_enable       INTEGER
+);
+
+INSERT INTO pdp_profile_upgrade
+ SELECT profile_id, profile_name, apn, auth_type, auth_id, auth_pwd, pdp_protocol, pdp_protocol, proxy_ip_addr, home_url, linger_time, traffic_class, is_static_ip_addr, ip_addr, is_static_dns_addr, dns_addr1, dns_addr2, network_info_id, svc_category_id, hidden, editable, default_internet_con, user_defined, is_roaming_apn, profile_enable
+ FROM 'pdp_profile';
+
+DROP TABLE 'pdp_profile';
+ALTER TABLE 'pdp_profile_upgrade' RENAME TO 'pdp_profile';
+
+DROP INDEX IF EXISTS "pdp_profile_ix_1";
+CREATE INDEX pdp_profile_ix_1 ON pdp_profile (network_info_id);