From daa984f7ded708d0e1a97783552c019f2b3f6087 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 28 Nov 2024 11:06:02 +0100 Subject: [PATCH] feat(event cache store): enable foreign keys pragma \o/ --- crates/matrix-sdk-sqlite/src/event_cache_store.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/matrix-sdk-sqlite/src/event_cache_store.rs b/crates/matrix-sdk-sqlite/src/event_cache_store.rs index 4b2c6cd263e..d22d8f21eda 100644 --- a/crates/matrix-sdk-sqlite/src/event_cache_store.rs +++ b/crates/matrix-sdk-sqlite/src/event_cache_store.rs @@ -358,6 +358,9 @@ async fn run_migrations(conn: &SqliteAsyncConn, version: u8) -> Result<()> { } if version < 3 { + // Enable foreign keys for this database. + conn.execute_batch("PRAGMA foreign_keys = ON;").await?; + conn.with_transaction(|txn| { txn.execute_batch(include_str!("../migrations/event_cache_store/003_events.sql"))?; txn.set_db_version(3)