git » sdk » commit b0d4d41

Run all migrations not just the first

author Stephen Paul Weber
2025-05-21 17:29:28 UTC
committer Stephen Paul Weber
2025-06-24 17:15:22 UTC
parent 1767a154434ea6b5413a81de56a9341479a713eb

Run all migrations not just the first

snikket/persistence/Sqlite.hx +3 -4

diff --git a/snikket/persistence/Sqlite.hx b/snikket/persistence/Sqlite.hx
index 8f7bdb2..8165d94 100644
--- a/snikket/persistence/Sqlite.hx
+++ b/snikket/persistence/Sqlite.hx
@@ -38,7 +38,7 @@ class Sqlite implements Persistence implements KeyValueStore {
 		db = new SqliteDriver(dbfile);
 		db.exec("PRAGMA user_version;").then(iter -> {
 			final version = Std.parseInt(iter.next()?.user_version) ?? 0;
-			return if (version < 1) {
+			if (version < 1) {
 				db.exec(["CREATE TABLE messages (
 					account_id TEXT NOT NULL,
 					mam_id TEXT NOT NULL,
@@ -112,13 +112,12 @@ class Sqlite implements Persistence implements KeyValueStore {
 					PRIMARY KEY (account_id, chat_id, sender_id, update_id)
 				) STRICT;",
 				"PRAGMA user_version = 1;"]);
-			} else if (version < 2) {
+			}
+			if (version < 2) {
 				db.exec(["ALTER TABLE chats ADD COLUMN notifications_filtered INTEGER;",
 				"ALTER TABLE chats ADD COLUMN notify_mention INTEGER NOT NULL DEFAULT 0;",
 				"ALTER TABLE chats ADD COLUMN notify_reply INTEGER NOT NULL DEFAULT 0;",
 				"PRAGMA user_version = 2;"]);
-			} else {
-				Promise.resolve(null);
 			}
 		});
 	}