mirror of https://github.com/KDE/kasts.git
Avoid RENAME COLUMN to make db migration more robust
RENAME COLUMN was only introduced in sqlite 3.25. So it's probably better to avoid it for the time being to increase compatibility with older versions.
This commit is contained in:
parent
e0154355aa
commit
3a24ea6f65
|
@ -80,9 +80,11 @@ bool Database::migrateTo2()
|
|||
bool Database::migrateTo3()
|
||||
{
|
||||
qDebug() << "Migrating database to version 3";
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("ALTER TABLE Enclosures RENAME COLUMN downloaded TO downloaded_temp;")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("ALTER TABLE Enclosures ADD COLUMN downloaded_temp BOOL DEFAULT 0;")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("UPDATE Enclosures SET downloaded_temp=1 WHERE downloaded=1;")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("ALTER TABLE Enclosures DROP COLUMN downloaded;")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("ALTER TABLE Enclosures ADD COLUMN downloaded INTEGER DEFAULT 0;")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("UPDATE Enclosures SET downloaded=3 where downloaded_temp=1;")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("UPDATE Enclosures SET downloaded=3 WHERE downloaded_temp=1;")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("ALTER TABLE Enclosures DROP COLUMN downloaded_temp;")));
|
||||
TRUE_OR_RETURN(execute(QStringLiteral("PRAGMA user_version = 3;")));
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue