• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_CLOUD_SYNC_DATA_SYNCER_RDB_COL_H
17 #define OHOS_CLOUD_SYNC_DATA_SYNCER_RDB_COL_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace FileManagement {
23 namespace CloudSync {
24 /* basic */
25 const std::string DATA_SYNCER_ID = "dataSyncerId";
26 const std::string USER_ID = "userId";
27 const std::string BUNDLE_NAME = "bundleName";
28 const std::string SYNC_STATE = "syncState";
29 const std::string LAST_SYNC_TIME = "lastSyncTime";
30 const std::string DATA_SYNCER_UNIQUE_ID = "dataSyncerUniqueId";
31 
32 const std::string DATA_SYNCER_TABLE = "DataSyncers";
33 
34 const std::string DATA_SYNCER_UNIQUE_INDEX = "DataSyncersUniqueIndex";
35 
36 const std::string CREATE_DATA_SYNCER_TABLE = "CREATE TABLE IF NOT EXISTS " +
37     DATA_SYNCER_TABLE + " (" +
38     DATA_SYNCER_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
39     USER_ID + " INT, " +
40     BUNDLE_NAME + " TEXT, " +
41     SYNC_STATE + " INT DEFAULT 0, " +
42     LAST_SYNC_TIME + " BIGINT DEFAULT 0, " +
43     DATA_SYNCER_UNIQUE_ID + " TEXT)";
44 
45 const std::string CREATE_DATA_SYNCER_UNIQUE_INDEX =
46         "CREATE UNIQUE INDEX IF NOT EXISTS " + DATA_SYNCER_UNIQUE_INDEX +
47         " ON " + DATA_SYNCER_TABLE + " (" + DATA_SYNCER_UNIQUE_ID + ")";
48 
49 const std::set<std::string> DATA_SYNCER_COL = {
50     DATA_SYNCER_ID, USER_ID, BUNDLE_NAME, SYNC_STATE, LAST_SYNC_TIME, DATA_SYNCER_UNIQUE_ID
51 };
52 
53 const std::string EL1_CLOUDFILE_DIR = "/data/service/el1/public/cloudfile";
54 const std::string DATA_SYNCER_DB = "DataSyncers.db";
55 
56 const int32_t CLOUD_DISK_RDB_VERSION = 2;
57 enum {
58     VERSION_ADD_DATA_SYNCER_UNIQUE_INDEX = 2,
59 };
60 } // namespace CloudSync
61 } // namespace FileManagement
62 } // namespace OHOS
63 #endif // OHOS_CLOUD_SYNC_DATA_SYNCER_RDB_COL_H
64