mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-04-05 11:05:51 +00:00
agent sqlite: enable FKs in *all* db connections (#75)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user