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

Commit

Permalink
Using mappend rather than <> for compatability
Browse files Browse the repository at this point in the history
Not very pretty...
  • Loading branch information
andrevdm committed Oct 12, 2019
1 parent 121f9d7 commit e2ea683
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Database/PostgreSQL/Simple/Migration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ executeMigration con tableName verbose name contents = do
when verbose $ putStrLn $ "Fail:\t" ++ name
return (MigrationError name)
where
q = "insert into " <> Query tableName <> "(filename, checksum) values(?, ?)"
q = "insert into " `mappend` Query tableName `mappend` "(filename, checksum) values(?, ?)"

-- | Initializes the database schema with a helper table containing
-- meta-information about executed migrations.
initializeSchema :: Connection -> BS.ByteString -> Bool -> IO ()
initializeSchema con tableName verbose = do
when verbose $ putStrLn "Initializing schema"
void $ execute_ con $ mconcat
[ "create table if not exists " <> Query tableName <> " "
[ "create table if not exists " `mappend` Query tableName `mappend` " "
, "( filename varchar(512) not null"
, ", checksum varchar(32) not null"
, ", executed_at timestamp without time zone not null default now() "
Expand All @@ -207,7 +207,7 @@ executeValidation con tableName' verbose cmd =
MigrationInitialization ->
existsTable con tableName >>= \r -> return $ if r
then MigrationSuccess
else MigrationError $ "No such table: " <> tableName
else MigrationError $ "No such table: " `mappend` tableName
MigrationDirectory path ->
scriptsInDirectory path >>= goScripts path
MigrationScript name contents ->
Expand Down Expand Up @@ -250,7 +250,7 @@ checkScript con tableName name checksum =
return (ScriptModified actualChecksum)
where
q = mconcat
[ "select checksum from " <> Query tableName <> " "
[ "select checksum from " `mappend` Query tableName `mappend` " "
, "where filename = ? limit 1"
]

Expand Down Expand Up @@ -348,7 +348,7 @@ getMigrations' :: Connection -> BS.ByteString -> IO [SchemaMigration]
getMigrations' con tableName = query_ con q
where q = mconcat
[ "select filename, checksum, executed_at "
, "from " <> Query tableName <> " order by executed_at asc"
, "from " `mappend` Query tableName `mappend` " order by executed_at asc"
]

-- | A product type representing a single, executed 'SchemaMigration'.
Expand Down

0 comments on commit e2ea683

Please sign in to comment.