diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp @@ -93,7 +93,7 @@ bool create_persist_account_table(sqlite3 *db) { std::string query = - "CREATE TABLE olm_persist_account(" + "CREATE TABLE IF NOT EXISTS olm_persist_account(" "id INTEGER UNIQUE PRIMARY KEY NOT NULL, " "account_data TEXT NOT NULL);"; return create_table(db, query, "olm_persist_account"); @@ -101,7 +101,7 @@ bool create_persist_sessions_table(sqlite3 *db) { std::string query = - "CREATE TABLE olm_persist_sessions(" + "CREATE TABLE IF NOT EXISTS olm_persist_sessions(" "target_user_id TEXT UNIQUE PRIMARY KEY NOT NULL, " "session_data TEXT NOT NULL);"; return create_table(db, query, "olm_persist_sessions"); @@ -141,7 +141,7 @@ char *error; sqlite3_exec( db, - "CREATE INDEX messages_idx_thread_time " + "CREATE INDEX IF NOT EXISTS messages_idx_thread_time " "ON messages (thread, time);", nullptr, nullptr, @@ -176,7 +176,7 @@ char *error; sqlite3_exec( db, - "CREATE INDEX media_idx_container " + "CREATE INDEX IF NOT EXISTS media_idx_container " "ON media (container);", nullptr, nullptr,