[SVACE Issue Fixes]
[platform/core/pim/contacts-service.git] / server / db / ctsvc_db_schema.h
1 /*
2  * Contacts Service
3  *
4  * Copyright (c) 2010 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19 #ifndef __CTSVC_DB_SCHEMA_H__
20 #define __CTSVC_DB_SCHEMA_H__
21
22 #include <tzplatform_config.h>
23
24 #define CTSVC_DB_PATH tzplatform_mkpath(TZ_USER_DB, "privacy/.contacts-svc.db")
25
26 /* For Security */
27 #define CTS_SECURITY_FILE_GROUP 5000
28 #define CTS_SECURITY_DEFAULT_PERMISSION 0666
29 #define CTS_SECURITY_DIR_DEFAULT_PERMISSION 0770
30
31 #define CTS_SCHEMA_TABLE_TOTAL 10
32
33 /* DB Tables */
34 #define CTS_TABLE_PERSONS "persons"
35 #define CTS_TABLE_CONTACTS "contacts"
36 #define CTS_TABLE_GROUPS "groups"
37 #define CTS_TABLE_ADDRESSBOOKS "addressbooks"
38 #define CTS_TABLE_DATA "data"  /* This is the data table for contact all fields */
39 #define CTS_TABLE_FAVORITES "favorites"
40 #define CTS_TABLE_PHONELOGS "phonelogs"
41 #define CTS_TABLE_PHONELOG_ACC "phonelog_accumulation"
42 #define CTS_TABLE_PHONELOG_STAT "phonelog_stat"
43 #define CTS_TABLE_GROUP_RELATIONS "group_relations"
44 #define CTS_TABLE_DELETEDS "contact_deleteds"
45 #define CTS_TABLE_GROUP_DELETEDS "group_deleteds"
46 #define CTS_TABLE_CUSTOM_TYPES "custom_types"
47 #define CTS_TABLE_SDN "sdn"
48 #define CTS_TABLE_SPEEDDIALS "speeddials"
49 #define CTS_TABLE_VERSION "cts_version"
50 #define CTS_TABLE_MY_PROFILES "my_profiles"
51 #define CTS_TABLE_CONTACT_STAT "contact_stat"
52 #define CTS_TABLE_NAME_LOOKUP "name_lookup"
53 #define CTS_TABLE_PHONE_LOOKUP "phone_lookup"
54 #define CTS_TABLE_SEARCH_INDEX "search_index"
55 #define CTS_TABLE_SIM_INFO "sim_info"
56
57 #define CTS_TABLE_ACTIVITIES "activities"
58 #define CTS_TABLE_ACTIVITY_PHOTOS "activity_photos"
59
60 /* DB views */
61 #define CTSVC_DB_VIEW_PERSON "view_person"
62 #define CTSVC_DB_VIEW_CONTACT "view_contact"
63 #define CTSVC_DB_VIEW_MY_PROFILE "view_my_profile"
64
65 #define CTSVC_DB_VIEW_NAME "view_name"
66 #define CTSVC_DB_VIEW_NUMBER "view_number"
67 #define CTSVC_DB_VIEW_EMAIL "view_email"
68 #define CTSVC_DB_VIEW_ADDRESS "view_address"
69 #define CTSVC_DB_VIEW_URL "view_url"
70 #define CTSVC_DB_VIEW_EVENT "view_event"
71 #define CTSVC_DB_VIEW_RELATIONSHIP "view_relationship"
72 #define CTSVC_DB_VIEW_IMAGE "view_image"
73 #define CTSVC_DB_VIEW_COMPANY "view_company"
74 #define CTSVC_DB_VIEW_GROUP_RELATION "view_group_relation"
75 #define CTSVC_DB_VIEW_NICKNAME "view_nickname"
76 #define CTSVC_DB_VIEW_MESSENGER "view_messenger"
77 #define CTSVC_DB_VIEW_NOTE "view_note"
78 #define CTSVC_DB_VIEW_PROFILE "view_profile"
79 #define CTSVC_DB_VIEW_EXTENSION "view_extension"
80 #define CTSVC_DB_VIEW_SIP "view_sip"
81
82 #define CTSVC_DB_VIEW_ACTIVITY "view_activity"
83 #define CTSVC_DB_VIEW_ACTIVITY_PHOTOS "view_activity_photos"
84 #define CTSVC_DB_VIEW_SPEEDIDAL "view_speeddial"
85
86 /* #define CTSVC_DB_VIEW_GROUPS_UPDATED_INFO "view_group_changes" */
87 /* #define CTSVC_DB_VIEW_GROUPS_MEMBER_UPDATED_INFO "view_group_member_changes" */
88 /* #define CTSVC_DB_VIEW_CONTACTS_UPDATED_INFO "view_contacts_changes" */
89
90 #define CTSVC_DB_VIEW_PERSON_CONTACT "view_person_contact"
91 #define CTSVC_DB_VIEW_PERSON_NUMBER "view_person_contact_number"
92 #define CTSVC_DB_VIEW_PERSON_EMAIL "view_person_contact_email"
93 #define CTSVC_DB_VIEW_PERSON_GROUP "view_person_contact_group"
94 #define CTSVC_DB_VIEW_PERSON_GROUP_ASSIGNED "view_person_contact_group_assigned"
95 #define CTSVC_DB_VIEW_PERSON_GROUP_NOT_ASSIGNED "view_person_contact_group_not_assigned"
96
97 #define CTSVC_DB_VIEW_PERSON_PHONELOG "view_person_contact_phonelog"
98 #define CTSVC_DB_VIEW_PERSON_USAGE "view_person_usage"
99
100 #define CTSVC_DB_VIEW_CONTACT_NUMBER "view_contact_number"
101 #define CTSVC_DB_VIEW_CONTACT_EMAIL "view_contact_email"
102 #define CTSVC_DB_VIEW_CONTACT_GROUP "view_contact_group"
103
104 #define CTSVC_DB_VIEW_CONTACT_ACTIVITY "view_contact_activity"
105
106
107 #define CTS_SCHEMA_DATA_NAME_LANG_INFO "data1"
108 #define CTS_SCHEMA_DATA_NAME_LOOKUP "data7"
109 #define CTS_SCHEMA_DATA_NAME_REVERSE_LOOKUP "data8"
110
111 #define CTS_SCHEMA_SQLITE_SEQ "sqlite_sequence"
112
113 #define CTS_SCHEMA_DISPLAY_NAME "display_name"
114 #define CTS_SCHEMA_REVERSE_DISPLAY_NAME "reverse_display_name"
115 #define CTS_SCHEMA_SORTKEY  "sortkey"
116 #define CTS_SCHEMA_REVERSE_SORTKEY  "reverse_sortkey"
117
118
119 #endif /* __CTSVC_DB_SCHEMA_H__ */