Skip to content

Commit

Permalink
dbhub: Add column for branches to local database
Browse files Browse the repository at this point in the history
  • Loading branch information
MKleusberg committed Sep 30, 2017
1 parent 34df190 commit 8a540a2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/RemoteDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,8 @@ void RemoteDatabase::localAssureOpened()
"\"url\" TEXT NOT NULL,"
"\"commit_id\" TEXT NOT NULL,"
"\"file\" INTEGER,"
"\"modified\" INTEGER DEFAULT 0"
"\"modified\" INTEGER DEFAULT 0,"
"\"branch\" TEXT NOT NULL DEFAULT \"master\""
")");
if(sqlite3_exec(m_dbLocal, statement.toUtf8(), NULL, NULL, &errmsg) != SQLITE_OK)
{
Expand All @@ -528,6 +529,12 @@ void RemoteDatabase::localAssureOpened()
m_dbLocal = nullptr;
return;
}

// Add column "branch" if it doesn't exist yet. This isn't done in a particular nice way here because we just let the
// command fail if it already exists but whatever.
// NOTE that this code can be removed after releasing v3.11.0.
statement = QString("ALTER TABLE \"local\" ADD COLUMN \"branch\" TEXT NOT NULL DEFAULT \"master\"");
sqlite3_exec(m_dbLocal, statement.toUtf8(), NULL, NULL, NULL);
}

void RemoteDatabase::localAdd(QString filename, QString identity, const QUrl& url)
Expand Down

0 comments on commit 8a540a2

Please sign in to comment.