refactor(syncjournaldb): refactor logic before updating the list of columns when removing one.

Signed-off-by: Camila Ayres <hello@camilasan.com>
This commit is contained in:
Camila Ayres 2025-08-12 22:50:59 +02:00 committed by Matthieu Gallien
parent 0a320a5960
commit cd2fc99497

View File

@ -895,16 +895,20 @@ bool SyncJournalDb::updateMetadataTableStructure()
const auto quotaBytesAvailable = QStringLiteral("quotaBytesAvailable");
const auto defaultCommand = QStringLiteral("DEFAULT -1 NOT NULL");
const auto bigInt = QStringLiteral("BIGINT");
auto result = false;
if (columnExists(quotaBytesUsed) && !hasDefaultValue(quotaBytesUsed)) {
re = removeColumn(quotaBytesUsed);
result = removeColumn(quotaBytesUsed);
}
if (columnExists(quotaBytesAvailable) && !hasDefaultValue(quotaBytesAvailable)) {
re = removeColumn(quotaBytesAvailable);
result = removeColumn(quotaBytesAvailable);
}
if (result) {
columns = tableColumns("metadata");
}
columns = tableColumns("metadata");
addColumn(quotaBytesUsed, bigInt, false, defaultCommand);
addColumn(quotaBytesAvailable, bigInt, false, defaultCommand);
}