Commit after insert, but not in test
This commit is contained in:
@@ -109,6 +109,7 @@ insert schema table row conn = do
|
|||||||
query <- populateSql conn ("insert into %I.%I ("++colIds++")", map toSql $ schema:table:cols)
|
query <- populateSql conn ("insert into %I.%I ("++colIds++")", map toSql $ schema:table:cols)
|
||||||
stmt <- prepare conn (query ++ " values ("++phs++") returning *")
|
stmt <- prepare conn (query ++ " values ("++phs++") returning *")
|
||||||
_ <- execute stmt values
|
_ <- execute stmt values
|
||||||
|
commit conn
|
||||||
keys <- getColumnNames stmt
|
keys <- getColumnNames stmt
|
||||||
Just vals <- fetchRow stmt
|
Just vals <- fetchRow stmt
|
||||||
let rowMap = fromList $ zip keys vals
|
let rowMap = fromList $ zip keys vals
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ loadFixture name = do
|
|||||||
runRaw conn "drop schema if exists public cascade"
|
runRaw conn "drop schema if exists public cascade"
|
||||||
runRaw conn "create schema public"
|
runRaw conn "create schema public"
|
||||||
runRaw conn sql
|
runRaw conn sql
|
||||||
commit conn
|
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
@@ -31,7 +30,6 @@ spec = beforeAll (loadFixture "schema") $ do
|
|||||||
("non_nullable_string", toSql ("a string that isn't null" :: String))
|
("non_nullable_string", toSql ("a string that isn't null" :: String))
|
||||||
]) conn
|
]) conn
|
||||||
r <- quickQuery conn "select count(1) from auto_incrementing_pk" []
|
r <- quickQuery conn "select count(1) from auto_incrementing_pk" []
|
||||||
commit conn
|
|
||||||
[[toSql (1 :: Int)]] `shouldBe` r
|
[[toSql (1 :: Int)]] `shouldBe` r
|
||||||
|
|
||||||
describe "insert again" $
|
describe "insert again" $
|
||||||
|
|||||||
Reference in New Issue
Block a user