-- Migrate DB from version 6
-- Remove DB value for verified status, we're back to using the Rust SDK as a source of truth

CREATE TABLE SessionData_bak (
    userId TEXT NOT NULL PRIMARY KEY,
    deviceId TEXT NOT NULL,
    accessToken TEXT NOT NULL,
    refreshToken TEXT,
    homeserverUrl TEXT NOT NULL,
    slidingSyncProxy TEXT,
    loginTimestamp INTEGER,
    oidcData TEXT,
    isTokenValid INTEGER NOT NULL DEFAULT 1,
    loginType TEXT,
    passphrase TEXT
);

INSERT INTO SessionData_bak SELECT userId, deviceId, accessToken, refreshToken, homeserverUrl, slidingSyncProxy, loginTimestamp, oidcData, isTokenValid, loginType, passphrase FROM SessionData;
DROP TABLE SessionData;
ALTER TABLE SessionData_bak RENAME TO SessionData;
