Skip to content

Commit 2eedc29

Browse files
committed
Proper support for multi-line migration scripts in sqlite
1 parent 707d92e commit 2eedc29

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

beam-sqlite/Database/Beam/Sqlite/Migrate.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ import Control.Exception
3030
import Control.Monad
3131
import Control.Monad.Reader
3232

33-
import Database.SQLite.Simple (open, close, query_, execute_, Query(..))
33+
import Database.SQLite.Simple (open, close, query_, execute_, connectionHandle)
34+
import Database.SQLite3 (exec)
3435

3536
import Data.Aeson
3637
import Data.Attoparsec.Text (asciiCI, skipSpace)
@@ -251,7 +252,8 @@ parseSqliteDataType txt =
251252
runSqlScript :: T.Text -> SqliteM ()
252253
runSqlScript t =
253254
SqliteM . ReaderT $ \(_, conn) ->
254-
execute_ conn (Query t)
255+
let hdl = connectionHandle conn
256+
in exec hdl t
255257

256258
-- TODO constraints and foreign keys
257259

beam-sqlite/beam-sqlite.cabal

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ library
4242
aeson >=0.11 && <2.3,
4343
attoparsec >=0.13 && <0.15,
4444
transformers-base >=0.4 && <0.5,
45-
-- Dependency on direct-sqlite is not direct,
46-
-- but functionality in beam-sqlite depends on
47-
-- a minimum version of sqlite. At this time,
48-
-- we require at least sqlite-3.24.
49-
-- Note that because of this, we cannot use the
50-
-- `Wunused-packages` warning.
51-
-- See #589
5245
direct-sqlite >=2.3.24
5346
default-language: Haskell2010
5447
default-extensions: ScopedTypeVariables, OverloadedStrings, MultiParamTypeClasses, RankNTypes, FlexibleInstances,

0 commit comments

Comments
 (0)