mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
parent
b922e1ae73
commit
c51aa2d573
1 changed files with 16 additions and 1 deletions
|
@ -61,7 +61,7 @@ namespace
|
||||||
{
|
{
|
||||||
const QString DB_CONNECTION_NAME = u"ResumeDataStorage"_qs;
|
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_META = u"meta"_qs;
|
||||||
const QString DB_TABLE_TORRENTS = u"torrents"_qs;
|
const QString DB_TABLE_TORRENTS = u"torrents"_qs;
|
||||||
|
@ -511,6 +511,12 @@ void BitTorrent::DBResumeDataStorage::createDB() const
|
||||||
if (!query.exec(createTableTorrentsQuery))
|
if (!query.exec(createTableTorrentsQuery))
|
||||||
throw RuntimeError(query.lastError().text());
|
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())
|
if (!db.commit())
|
||||||
throw RuntimeError(db.lastError().text());
|
throw RuntimeError(db.lastError().text());
|
||||||
}
|
}
|
||||||
|
@ -553,6 +559,15 @@ void BitTorrent::DBResumeDataStorage::updateDB(const int fromVersion) const
|
||||||
throw RuntimeError(query.lastError().text());
|
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});
|
const QString updateMetaVersionQuery = makeUpdateStatement(DB_TABLE_META, {DB_COLUMN_NAME, DB_COLUMN_VALUE});
|
||||||
if (!query.prepare(updateMetaVersionQuery))
|
if (!query.prepare(updateMetaVersionQuery))
|
||||||
throw RuntimeError(query.lastError().text());
|
throw RuntimeError(query.lastError().text());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue