From: Hwankyu Jhun Date: Thu, 11 Apr 2024 00:49:18 +0000 (+0900) Subject: Modify upgrade script X-Git-Tag: accepted/tizen/unified/20240412.141422~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F309444%2F4;p=platform%2Fcore%2Fapi%2Fnotification.git Modify upgrade script If the current db version is equal to the db version of the script, the script should skipt the db upgrade. Change-Id: I8cd7fca856bbacf149755db71cdbfbe01dc45f43 Signed-off-by: Hwankyu Jhun --- diff --git a/scripts/505.notification_upgrade.sh.in b/scripts/505.notification_upgrade.sh.in index 57541a0d..eec70e61 100644 --- a/scripts/505.notification_upgrade.sh.in +++ b/scripts/505.notification_upgrade.sh.in @@ -9,18 +9,17 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin DB_DIR=/opt/dbspace DB_NOTIFICATION=$DB_DIR/.notification.db -DB_VERSION=1 +DB_VERSION=2 + +CURRENT_VERSION=`sqlite3 $DB_NOTIFICATION 'PRAGMA user_version'` CheckListTable() { ADDED_COLUMN=`sqlite3 $DB_NOTIFICATION 'PRAGMA table_info(noti_list)' | grep b_event_handler_click_on_button_7` - CHECKBOX_COLUMN=`sqlite3 $DB_NOTIFICATION 'PRAGMA table_info(noti_list)' | grep check_box` - CURRENT_VERSION=`sqlite3 $DB_NOTIFICATION 'PRAGMA user_version'` - echo "## Check list table" - if [ -z "${ADDED_COLUMN}" ] || [ -z "${CHECKBOX_COLUMN}" ] || [ ${CURRENT_VERSION} -ne ${DB_VERSION} ]; then + if [ -z "${ADDED_COLUMN}" ] || [ -z "${CHECKBOX_COLUMN}" ]; then echo "column empty" return 1 else @@ -31,14 +30,11 @@ CheckListTable() { CheckTemplateTable() { ADDED_COLUMN=`sqlite3 $DB_NOTIFICATION 'PRAGMA table_info(noti_template)' | grep template_name` - CHECKBOX_COLUMN=`sqlite3 $DB_NOTIFICATION 'PRAGMA table_info(noti_template)' | grep check_box` - CURRENT_VERSION=`sqlite3 $DB_NOTIFICATION 'PRAGMA user_version'` - echo "## Check template table" - if [ -z "${ADDED_COLUMN}" ] || [ -z "${CHECKBOX_COLUMN}" ] || [ ${CURRENT_VERSION} -ne ${DB_VERSION} ]; then + if [ -z "${ADDED_COLUMN}" ] || [ -z "${CHECKBOX_COLUMN}" ]; then echo "column empty" return 1 else @@ -236,7 +232,6 @@ UpdateNotiDB() { RESULT=$? if [ ${RESULT} == 1 ]; then UpdateListTable - UpdateDBVersion echo "update list table" else echo "list table already updated" @@ -251,7 +246,10 @@ UpdateNotiDB() { echo "template table already updated" fi + UpdateDBVersion UpdatePermission } -UpdateNotiDB +if [[ $CURRENT_VERSION -lt $DB_VERSION ]]; then + UpdateNotiDB +fi