From: Myungki Lee Date: Mon, 5 Sep 2016 13:33:31 +0000 (+0900) Subject: Add a script to upgrade notification db X-Git-Tag: submit/tizen/20160912.053645~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e55256ab28e1ba54291e577c40ab6e437ccaa19a;p=platform%2Fcore%2Fapi%2Fnotification.git Add a script to upgrade notification db Change-Id: Ifadf87c7a68abc86a74af61196a56f3374d12f24 Signed-off-by: Myungki Lee --- diff --git a/packaging/notification.spec b/packaging/notification.spec index 60eb4bcd..9a62af11 100755 --- a/packaging/notification.spec +++ b/packaging/notification.spec @@ -29,6 +29,8 @@ Requires(post): /sbin/ldconfig Requires(post): %{TZ_SYS_BIN}/sqlite3 Requires(postun): /sbin/ldconfig +%define upgrade_script_path /usr/share/upgrade/scripts + %description Client/Server library for sending notifications. @@ -60,6 +62,9 @@ rm -rf %{buildroot} mkdir -p %{buildroot}%{TZ_SYS_SHARE}/license cp -f LICENSE %{buildroot}%{TZ_SYS_SHARE}/license/%{name} +mkdir -p %{buildroot}%{upgrade_script_path} +cp -f scripts/105.notification_upgrade.sh %{buildroot}%{upgrade_script_path} + %clean rm -rf %{buildroot} @@ -80,6 +85,7 @@ fi %{TZ_SYS_SHARE}/license/%{name} %attr(755,root,root) %{_sysconfdir}/gumd/useradd.d/11_notification-add.post %{_bindir}/notification_init +%{upgrade_script_path}/105.notification_upgrade.sh #%{_bindir}/notification-test-app %files devel diff --git a/scripts/105.notification_upgrade.sh b/scripts/105.notification_upgrade.sh new file mode 100644 index 00000000..e072d788 --- /dev/null +++ b/scripts/105.notification_upgrade.sh @@ -0,0 +1,169 @@ +#!/bin/sh + +#------------------------------------------# +# notification patch for upgrade (2.4 -> 3.0) # +#------------------------------------------# + +# Macro +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +DB_DIR=/opt/dbspace +DB_NOTIFICATION=$DB_DIR/.notification.db + +sqlite3 $DB_NOTIFICATION << EOF + +DROP TABLE IF EXISTS noti_list_temp; +CREATE TABLE noti_list_temp ( + type INTEGER NOT NULL, + layout INTEGER NOT NULL default 0, + caller_pkgname TEXT NOT NULL, + launch_pkgname TEXT, + image_path TEXT, + group_id INTEGER default 0, + internal_group_id INTEGER default 0, + priv_id INTEGER PRIMARY KEY AUTOINCREMENT, + title_key TEXT, + b_text TEXT, + b_key TEXT, + tag TEXT, + b_format_args TEXT, + num_format_args INTEGER default 0, + text_domain TEXT, + text_dir TEXT, + time INTEGER default 0, + insert_time INTEGER default 0, + args TEXT, + group_args TEXT, + b_execute_option TEXT, + b_service_responding TEXT, + b_service_single_launch TEXT, + b_service_multi_launch TEXT, + b_event_handler_click_on_button_1 TEXT, + b_event_handler_click_on_button_2 TEXT, + b_event_handler_click_on_button_3 TEXT, + b_event_handler_click_on_button_4 TEXT, + b_event_handler_click_on_button_5 TEXT, + b_event_handler_click_on_button_6 TEXT, + b_event_handler_click_on_icon TEXT, + b_event_handler_click_on_thumbnail TEXT, + sound_type INTEGER default 0, + sound_path TEXT, + vibration_type INTEGER default 0, + vibration_path TEXT, + led_operation INTEGER default 0, + led_argb INTEGER default 0, + led_on_ms INTEGER default -1, + led_off_ms INTEGER default -1, + flags_for_property INTEGER default 0, + flag_simmode INTEGER default 0, + display_applist INTEGER, + progress_size DOUBLE default 0, + progress_percentage DOUBLE default 0, + ongoing_flag INTEGER default 0, + auto_remove INTEGER default 1, + uid INTEGER +); +INSERT INTO noti_list_temp (type, layout, caller_pkgname, launch_pkgname, image_path, group_id, internal_group_id, priv_id, title_key, b_text, b_key, tag, b_format_args, num_format_args, text_domain, text_dir, time, insert_time, args, group_args, b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, b_event_handler_click_on_button_1, b_event_handler_click_on_button_2, b_event_handler_click_on_button_3, b_event_handler_click_on_button_4, b_event_handler_click_on_button_5, b_event_handler_click_on_button_6, b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, flags_for_property, flag_simmode, display_applist, progress_size, progress_percentage, ongoing_flag, auto_remove) \ +SELECT type, layout, caller_pkgname, launch_pkgname, image_path, group_id, internal_group_id, priv_id, title_key, b_text, b_key, tag, b_format_args, num_format_args, text_domain, text_dir, time, insert_time, args, group_args, b_execute_option, b_service_responding, b_service_single_launch, b_service_multi_launch, b_event_handler_click_on_button_1, b_event_handler_click_on_button_2, b_event_handler_click_on_button_3, b_event_handler_click_on_button_4, b_event_handler_click_on_button_5, b_event_handler_click_on_button_6, b_event_handler_click_on_icon, b_event_handler_click_on_thumbnail, sound_type, sound_path, vibration_type, vibration_path, led_operation, led_argb, led_on_ms, led_off_ms, flags_for_property, flag_simmode, display_applist, progress_size, progress_percentage, ongoing_flag, auto_remove FROM noti_list; +UPDATE noti_list_temp SET uid=5001; +DROP TABLE noti_list; +ALTER TABLE noti_list_temp RENAME TO noti_list; + +DROP TABLE IF EXISTS notification_setting_temp; +CREATE TABLE notification_setting_temp ( + uid INTEGER, + package_name TEXT NOT NULL, + allow_to_notify INTEGER DEFAULT 1, + do_not_disturb_except INTEGER DEFAULT 0, + visibility_class INTEGER DEFAULT 0, + pop_up_notification INTEGER DEFAULT 1, + lock_screen_content_level INTEGER DEFAULT 0, + UNIQUE (uid, package_name) +); +INSERT INTO notification_setting_temp (package_name, allow_to_notify, do_not_disturb_except, visibility_class) \ +SELECT package_name, allow_to_notify, do_not_disturb_except, visibility_class FROM notification_setting; +UPDATE notification_setting_temp SET uid=5001; +DROP TABLE notification_setting; +ALTER TABLE notification_setting_temp RENAME TO notification_setting; + + +DROP TABLE IF EXISTS notification_system_setting_temp; +CREATE TABLE notification_system_setting_temp ( + uid INTEGER, + do_not_disturb INTEGER DEFAULT 0, + visibility_class INTEGER DEFAULT 0, + dnd_schedule_enabled INTEGER DEFAULT 0, + dnd_schedule_day INTEGER DEFAULT 0, + dnd_start_hour INTEGER DEFAULT 0, + dnd_start_min INTEGER DEFAULT 0, + dnd_end_hour INTEGER DEFAULT 0, + dnd_end_min INTEGER DEFAULT 0, + lock_screen_content_level INTEGER DEFAULT 0, + UNIQUE (uid) +); +INSERT INTO notification_system_setting_temp (do_not_disturb, visibility_class) \ +SELECT do_not_disturb, visibility_class FROM notification_system_setting; +UPDATE notification_system_setting_temp SET uid=5001; +DROP TABLE notification_system_setting; +ALTER TABLE notification_system_setting_temp RENAME TO notification_system_setting; + +DROP TABLE IF EXISTS noti_template; +CREATE TABLE noti_template ( + type INTEGER NOT NULL, + layout INTEGER NOT NULL default 0, + caller_pkgname TEXT NOT NULL, + launch_pkgname TEXT, + image_path TEXT, + group_id INTEGER default 0, + internal_group_id INTEGER default 0, + priv_id INTEGER PRIMARY KEY AUTOINCREMENT, + title_key TEXT, + b_text TEXT, + b_key TEXT, + tag TEXT, + b_format_args TEXT, + num_format_args INTEGER default 0, + text_domain TEXT, + text_dir TEXT, + time INTEGER default 0, + insert_time INTEGER default 0, + args TEXT, + group_args TEXT, + b_execute_option TEXT, + b_service_responding TEXT, + b_service_single_launch TEXT, + b_service_multi_launch TEXT, + b_event_handler_click_on_button_1 TEXT, + b_event_handler_click_on_button_2 TEXT, + b_event_handler_click_on_button_3 TEXT, + b_event_handler_click_on_button_4 TEXT, + b_event_handler_click_on_button_5 TEXT, + b_event_handler_click_on_button_6 TEXT, + b_event_handler_click_on_icon TEXT, + b_event_handler_click_on_thumbnail TEXT, + sound_type INTEGER default 0, + sound_path TEXT, + vibration_type INTEGER default 0, + vibration_path TEXT, + led_operation INTEGER default 0, + led_argb INTEGER default 0, + led_on_ms INTEGER default -1, + led_off_ms INTEGER default -1, + flags_for_property INTEGER default 0, + flag_simmode INTEGER default 0, + display_applist INTEGER, + progress_size DOUBLE default 0, + progress_percentage DOUBLE default 0, + ongoing_flag INTEGER default 0, + auto_remove INTEGER default 1, + uid INTEGER, + template_name TEXT, + UNIQUE (caller_pkgname, template_name) +); +EOF + +chown owner:users $DB_NOTIFICATION +chown owner:users $DB_NOTIFICATION-journal + +chsmack -a User::Home $DB_NOTIFICATION +chsmack -a User::Home $DB_NOTIFICATION-journal