Skip to content

Commit a6bc172

Browse files
committed
check for existing database
1 parent 6a39f16 commit a6bc172

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

source/gameanalytics/GAStore.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ namespace gameanalytics
211211
{
212212
std::string oldPath = device::GADevice::getWritablePath() + "/ga.sqlite3";
213213
std::string newPath = device::GADevice::getWritablePath() + "/" + state::GAState::getGameKey() + "/ga.sqlite3";
214-
if(std::filesystem::exists(oldPath))
214+
if(std::filesystem::exists(oldPath) && !std::filesystem::exists(newPath))
215215
{
216216
std::filesystem::rename(oldPath, newPath);
217217
return true;
@@ -260,13 +260,6 @@ namespace gameanalytics
260260
GAStore::executeQuerySync("DROP TABLE ga_progression");
261261
GAStore::executeQuerySync("VACUUM");
262262
}
263-
else if(shouldFixDb)
264-
{
265-
GAStore::executeQuerySync("DROP TABLE ga_events");
266-
GAStore::executeQuerySync("DROP TABLE ga_progression");
267-
GAStore::executeQuerySync("DROP TABLE ga_session");
268-
GAStore::executeQuerySync("VACUUM");
269-
}
270263

271264
// Create statements
272265
constexpr const char* sql_ga_events = "CREATE TABLE IF NOT EXISTS ga_events(status CHAR(50) NOT NULL, category CHAR(50) NOT NULL, session_id CHAR(50) NOT NULL, client_ts CHAR(50) NOT NULL, event TEXT NOT NULL);";

0 commit comments

Comments
 (0)