Skip to content
This repository was archived by the owner on Sep 20, 2021. It is now read-only.

Fix tests on 32 bit machines #28

Merged
merged 2 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ or in Haskell.

## Why?
Database migrations should not be hard. They should be under version control
and documented in both your production systems and in your project files.
and documented both in your production systems and in your project files.

## What?
This library executes SQL/Haskell migration scripts and keeps track of their
Expand Down
5 changes: 3 additions & 2 deletions src/Database/PostgreSQL/Simple/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ module Database.PostgreSQL.Simple.Util
import Control.Exception (finally)
import Database.PostgreSQL.Simple (Connection, Only (..), begin,
query, rollback)
import GHC.Int (Int64)

-- | Checks if the table with the given name exists in the database.
existsTable :: Connection -> String -> IO Bool
existsTable con table =
fmap checkRowCount (query con q (Only table) :: IO [[Int]])
fmap checkRowCount (query con q (Only table) :: IO [[Int64]])
where
q = "select count(relname) from pg_class where relname = ?"

checkRowCount :: [[Int]] -> Bool
checkRowCount :: [[Int64]] -> Bool
checkRowCount ((1:_):_) = True
checkRowCount _ = False

Expand Down