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

Commit

Permalink
Merge pull request #28 from shak-mar/fix-32bit
Browse files Browse the repository at this point in the history
Fix tests on 32 bit machines
  • Loading branch information
ameingast authored Sep 24, 2019
2 parents 0c89b20 + fc1d881 commit 1229914
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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

0 comments on commit 1229914

Please sign in to comment.