diff --git a/src/Simplex/Messaging/Agent/Store/SQLite.hs b/src/Simplex/Messaging/Agent/Store/SQLite.hs index ad72ca047..0b83bbd77 100644 --- a/src/Simplex/Messaging/Agent/Store/SQLite.hs +++ b/src/Simplex/Messaging/Agent/Store/SQLite.hs @@ -72,6 +72,7 @@ createSQLiteStore dbFilePath = do connectSQLiteStore :: MonadUnliftIO m => FilePath -> m SQLiteStore connectSQLiteStore dbFilePath = do dbConn <- liftIO $ DB.open dbFilePath + liftIO $ DB.execute_ dbConn "PRAGMA foreign_keys = ON;" return SQLiteStore {dbFilePath, dbConn} instance (MonadUnliftIO m, MonadError StoreError m) => MonadAgentStore SQLiteStore m where diff --git a/src/Simplex/Messaging/Agent/Store/SQLite/Schema.hs b/src/Simplex/Messaging/Agent/Store/SQLite/Schema.hs index 7ca9a5f85..12d886a4e 100644 --- a/src/Simplex/Messaging/Agent/Store/SQLite/Schema.hs +++ b/src/Simplex/Messaging/Agent/Store/SQLite/Schema.hs @@ -10,8 +10,7 @@ createSchema :: Connection -> IO () createSchema conn = mapM_ (execute_ conn) - [ enableFKs, - servers, + [ servers, rcvQueues, sndQueues, connections, @@ -20,9 +19,6 @@ createSchema conn = sndMessages ] -enableFKs :: Query -enableFKs = "PRAGMA foreign_keys = ON;" - -- port is either a port number or a service name, see Network.Socket.Info.ServiceName servers :: Query servers =