agent sqlite: enable FKs in *all* db connections (#75)

This commit is contained in:
Efim Poberezkin
2021-03-29 19:27:05 +04:00
committed by GitHub
parent 08171e987d
commit bd753dbe47
2 changed files with 2 additions and 5 deletions

View File

@@ -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

View File

@@ -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 =