Skip to content

Commit

Permalink
Remove test sql query when updating db
Browse files Browse the repository at this point in the history
  • Loading branch information
c4181 committed Jul 13, 2023
1 parent 47a3519 commit 62ffbfe
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/base/bittorrent/dbresumedatastorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,15 +611,10 @@ void BitTorrent::DBResumeDataStorage::updateDB(const int fromVersion) const

if (fromVersion <= 4)
{
const auto testQuery = u"SELECT COUNT(%1) FROM %2;"_s
.arg(quoted(DB_COLUMN_INACTIVE_SEEDING_TIME_LIMIT.name), quoted(DB_TABLE_TORRENTS));
if (!query.exec(testQuery))
{
const auto alterTableTorrentsQuery = u"ALTER TABLE %1 ADD %2"_s
.arg(quoted(DB_TABLE_TORRENTS), makeColumnDefinition(DB_COLUMN_INACTIVE_SEEDING_TIME_LIMIT, "INTEGER NOT NULL"));
if (!query.exec(alterTableTorrentsQuery))
throw RuntimeError(query.lastError().text());
}
const auto alterTableTorrentsQuery = u"ALTER TABLE %1 ADD %2"_s
.arg(quoted(DB_TABLE_TORRENTS), makeColumnDefinition(DB_COLUMN_INACTIVE_SEEDING_TIME_LIMIT, "INTEGER NOT NULL"));
if (!query.exec(alterTableTorrentsQuery))
throw RuntimeError(query.lastError().text());
}

const QString updateMetaVersionQuery = makeUpdateStatement(DB_TABLE_META, {DB_COLUMN_NAME, DB_COLUMN_VALUE});
Expand Down

0 comments on commit 62ffbfe

Please sign in to comment.