mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
parent
b922e1ae73
commit
c51aa2d573
@ -61,7 +61,7 @@ namespace
|
||||
{
|
||||
const QString DB_CONNECTION_NAME = u"ResumeDataStorage"_qs;
|
||||
|
||||
const int DB_VERSION = 3;
|
||||
const int DB_VERSION = 4;
|
||||
|
||||
const QString DB_TABLE_META = u"meta"_qs;
|
||||
const QString DB_TABLE_TORRENTS = u"torrents"_qs;
|
||||
@ -511,6 +511,12 @@ void BitTorrent::DBResumeDataStorage::createDB() const
|
||||
if (!query.exec(createTableTorrentsQuery))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
const QString torrentsQueuePositionIndexName = u"%1_%2_INDEX"_qs.arg(DB_TABLE_TORRENTS, DB_COLUMN_QUEUE_POSITION.name);
|
||||
const QString createTorrentsQueuePositionIndexQuery = u"CREATE INDEX %1 ON %2 (%3)"_qs
|
||||
.arg(quoted(torrentsQueuePositionIndexName), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name));
|
||||
if (!query.exec(createTorrentsQueuePositionIndexQuery))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
||||
if (!db.commit())
|
||||
throw RuntimeError(db.lastError().text());
|
||||
}
|
||||
@ -553,6 +559,15 @@ void BitTorrent::DBResumeDataStorage::updateDB(const int fromVersion) const
|
||||
throw RuntimeError(query.lastError().text());
|
||||
}
|
||||
|
||||
if (fromVersion <= 3)
|
||||
{
|
||||
const QString torrentsQueuePositionIndexName = u"%1_%2_INDEX"_qs.arg(DB_TABLE_TORRENTS, DB_COLUMN_QUEUE_POSITION.name);
|
||||
const QString createTorrentsQueuePositionIndexQuery = u"CREATE INDEX %1 ON %2 (%3)"_qs
|
||||
.arg(quoted(torrentsQueuePositionIndexName), quoted(DB_TABLE_TORRENTS), quoted(DB_COLUMN_QUEUE_POSITION.name));
|
||||
if (!query.exec(createTorrentsQueuePositionIndexQuery))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
}
|
||||
|
||||
const QString updateMetaVersionQuery = makeUpdateStatement(DB_TABLE_META, {DB_COLUMN_NAME, DB_COLUMN_VALUE});
|
||||
if (!query.prepare(updateMetaVersionQuery))
|
||||
throw RuntimeError(query.lastError().text());
|
||||
|
Loading…
Reference in New Issue
Block a user