Merge pull request #1555 from vector-im/feature/bma/fixDbMigrationTest

Feature/bma/fix db migration test
This commit is contained in:
Benoit Marty
2023-10-12 16:23:01 +02:00
committed by GitHub
8 changed files with 23 additions and 1 deletions

View File

@@ -1,3 +1,13 @@
--------------------------------------------------------------------
-- Current version of the DB is the highest value of filename
-- in the folder `sqldelight/databases`.
--
-- When upgrading the schema, you have to create a file .sqm in the
-- `sqldelight/databases` folder and run the following task to
-- generate a .db file using the latest schema
-- > ./gradlew generateDebugSessionDatabaseSchema
--------------------------------------------------------------------
CREATE TABLE SessionData (
userId TEXT NOT NULL PRIMARY KEY,
deviceId TEXT NOT NULL,
@@ -5,9 +15,12 @@ CREATE TABLE SessionData (
refreshToken TEXT,
homeserverUrl TEXT NOT NULL,
slidingSyncProxy TEXT,
-- added in version 2
loginTimestamp INTEGER,
-- added in version 3
oidcData TEXT,
isTokenValid INTEGER NOT NULL,
-- added in version 4
isTokenValid INTEGER NOT NULL DEFAULT 1,
loginType TEXT
);

View File

@@ -1,3 +1,6 @@
-- This file is not striclty necessary, since the first
-- version of the DB is 1, so we will never migrate from 0
CREATE TABLE SessionData (
userId TEXT NOT NULL PRIMARY KEY,
deviceId TEXT NOT NULL,

View File

@@ -1 +1,3 @@
-- Migrate DB from version 1
ALTER TABLE SessionData ADD COLUMN loginTimestamp INTEGER;

View File

@@ -1 +1,3 @@
-- Migrate DB from version 2
ALTER TABLE SessionData ADD COLUMN oidcData TEXT;

View File

@@ -1,2 +1,4 @@
-- Migrate DB from version 3
ALTER TABLE SessionData ADD COLUMN isTokenValid INTEGER NOT NULL DEFAULT 1;
ALTER TABLE SessionData ADD COLUMN loginType TEXT;