Name: account-manager
Summary: Account Manager
-Version: 0.1.18
+Version: 0.1.19
Release: 1
Group: Social & Content/Other
License: Apache-2.0
Requires(post): /usr/bin/sqlite3
Requires(postun): /sbin/ldconfig
+%define upgrade_script_path /usr/share/upgrade/scripts
%description
Account Daemon: no
install -m 644 %SOURCE3 %{buildroot}%{_unitdir}/accounts-service.service
%install_service delayed.target.wants accounts-service.service
+mkdir -p %{buildroot}%{upgrade_script_path}
+cp -f scripts/500.account-manager.sh %{buildroot}%{upgrade_script_path}
+
%post
/sbin/ldconfig
#if [ ! -d /opt/usr/dbspace ]
%config %{_sysconfdir}/dbus-1/system.d/org.tizen.account.manager.conf
%license LICENSE.APLv2
%{_bindir}/account-svcd
+%{upgrade_script_path}/500.account-manager.sh
%attr(0644,root,root) %{_unitdir}/accounts-service.service
%attr(0644,root,root) %{_unitdir}/delayed.target.wants/accounts-service.service
%attr(0644,root,root) /usr/share/dbus-1/system-services/org.tizen.account.manager.service
--- /dev/null
+#!/bin/sh
+#
+#
+# RW update script for 4.0 -> 5.5
+#
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+source /usr/share/upgrade/rw-update-macro.inc
+
+# Macro
+GLOBAL_DB_DIR_55=/opt/dbspace
+GLOBAL_DB_ACCOUNT_MANAGER_55=$GLOBAL_DB_DIR_55/.account.db
+
+USER_DB_DIR_55=/opt/dbspace/5001
+USER_DB_ACCOUNT_MANAGER_55=$USER_DB_DIR_55/.account.db
+
+# Get version info
+get_version_info
+
+#------------------------------------------------#
+# account-manager patch for upgrade (4.0 -> 5.5) #
+#------------------------------------------------#
+if [ "$OLD_VER" = "4.0.0.0" ]; then
+
+# add new tables in global database
+sqlite3 $GLOBAL_DB_ACCOUNT_MANAGER_55 << EOF
+
+CREATE TABLE IF NOT EXISTS deleted_account
+(
+_id INTEGER,
+user_name TEXT,
+email_address TEXT,
+display_name TEXT,
+icon_path TEXT,
+source TEXT,
+package_name TEXT,
+access_token TEXT,
+domain_name TEXT,
+auth_type INTEGER,
+secret INTEGER,
+sync_support INTEGER,
+txt_custom0 TEXT,
+txt_custom1 TEXT,
+txt_custom2 TEXT,
+txt_custom3 TEXT,
+txt_custom4 TEXT,
+int_custom0 INTEGER,
+int_custom1 INTEGER,
+int_custom2 INTEGER,
+int_custom3 INTEGER,
+int_custom4 INTEGER
+);
+
+CREATE TABLE IF NOT EXISTS deleted_capability
+(
+_id INTEGER,
+key TEXT,
+value INTEGER,
+package_name TEXT,
+user_name TEXT,
+account_id INTEGER
+);
+
+CREATE TABLE IF NOT EXISTS deleted_account_custom
+(
+AccountId INTEGER,
+AppId TEXT,
+Key TEXT,
+Value TEXT
+);
+
+CREATE TRIGGER IF NOT EXISTS aft_acc_del AFTER DELETE ON account
+ BEGIN
+ INSERT INTO deleted_account VALUES (old._id, old.user_name, old.email_address, old.display_name, old.icon_path, old.source, old.package_name,
+ old.access_token, old.domain_name, old.auth_type, old.secret, old.sync_support, old.txt_custom0,
+ old.txt_custom1, old.txt_custom2, old.txt_custom3, old.txt_custom4, old.int_custom0, old.int_custom1,
+ old.int_custom2, old.int_custom3, old.int_custom4);
+ END;
+
+CREATE TRIGGER IF NOT EXISTS aft_capa_del AFTER DELETE ON capability
+ BEGIN
+ INSERT INTO deleted_capability VALUES (old._id, old.key, old.value, old.package_name, old.user_name, old.account_id);
+ END;
+
+CREATE TRIGGER IF NOT EXISTS aft_cust_del AFTER DELETE ON account_custom
+ BEGIN
+ INSERT INTO deleted_account_custom VALUES (old.AccountId, old.AppId, old.Key, old.Value);
+ END;
+
+EOF
+
+if [ -d "$USER_DB_DIR_55"]; then
+
+# add new tables in user database
+sqlite3 $USER_DB_ACCOUNT_MANAGER_55 << EOF
+
+CREATE TABLE IF NOT EXISTS deleted_account
+(
+_id INTEGER,
+user_name TEXT,
+email_address TEXT,
+display_name TEXT,
+icon_path TEXT,
+source TEXT,
+package_name TEXT,
+access_token TEXT,
+domain_name TEXT,
+auth_type INTEGER,
+secret INTEGER,
+sync_support INTEGER,
+txt_custom0 TEXT,
+txt_custom1 TEXT,
+txt_custom2 TEXT,
+txt_custom3 TEXT,
+txt_custom4 TEXT,
+int_custom0 INTEGER,
+int_custom1 INTEGER,
+int_custom2 INTEGER,
+int_custom3 INTEGER,
+int_custom4 INTEGER
+);
+
+CREATE TABLE IF NOT EXISTS deleted_capability
+(
+_id INTEGER,
+key TEXT,
+value INTEGER,
+package_name TEXT,
+user_name TEXT,
+account_id INTEGER
+);
+
+CREATE TABLE IF NOT EXISTS deleted_account_custom
+(
+AccountId INTEGER,
+AppId TEXT,
+Key TEXT,
+Value TEXT
+);
+
+CREATE TRIGGER IF NOT EXISTS aft_acc_del AFTER DELETE ON account
+ BEGIN
+ INSERT INTO deleted_account VALUES (old._id, old.user_name, old.email_address, old.display_name, old.icon_path, old.source, old.package_name,
+ old.access_token, old.domain_name, old.auth_type, old.secret, old.sync_support, old.txt_custom0, old.txt_custom1, old.txt_custom2, old.txt_custom3,
+ old.txt_custom4, old.int_custom0, old.int_custom1, old.int_custom2, old.int_custom3, old.int_custom4);
+ END;
+
+CREATE TRIGGER IF NOT EXISTS aft_capa_del AFTER DELETE ON capability
+ BEGIN
+ INSERT INTO deleted_capability VALUES (old._id, old.key, old.value, old.package_name, old.user_name, old.account_id);
+ END;
+
+CREATE TRIGGER IF NOT EXISTS aft_cust_del AFTER DELETE ON account_custom
+ BEGIN
+ INSERT INTO deleted_account_custom VALUES (old.AccountId, old.AppId, old.Key, old.Value);
+ END;
+
+EOF
+
+fi #end of "if [ -d "$USER_DB_DIR_55"]"
+
+fi #end of "if [ "$OLD_VER" = "4.0.0.0" ]"