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

Commit e2ea683

Browse files
committed
Using mappend rather than <> for compatability
Not very pretty...
1 parent 121f9d7 commit e2ea683

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Database/PostgreSQL/Simple/Migration.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,15 @@ executeMigration con tableName verbose name contents = do
174174
when verbose $ putStrLn $ "Fail:\t" ++ name
175175
return (MigrationError name)
176176
where
177-
q = "insert into " <> Query tableName <> "(filename, checksum) values(?, ?)"
177+
q = "insert into " `mappend` Query tableName `mappend` "(filename, checksum) values(?, ?)"
178178

179179
-- | Initializes the database schema with a helper table containing
180180
-- meta-information about executed migrations.
181181
initializeSchema :: Connection -> BS.ByteString -> Bool -> IO ()
182182
initializeSchema con tableName verbose = do
183183
when verbose $ putStrLn "Initializing schema"
184184
void $ execute_ con $ mconcat
185-
[ "create table if not exists " <> Query tableName <> " "
185+
[ "create table if not exists " `mappend` Query tableName `mappend` " "
186186
, "( filename varchar(512) not null"
187187
, ", checksum varchar(32) not null"
188188
, ", executed_at timestamp without time zone not null default now() "
@@ -207,7 +207,7 @@ executeValidation con tableName' verbose cmd =
207207
MigrationInitialization ->
208208
existsTable con tableName >>= \r -> return $ if r
209209
then MigrationSuccess
210-
else MigrationError $ "No such table: " <> tableName
210+
else MigrationError $ "No such table: " `mappend` tableName
211211
MigrationDirectory path ->
212212
scriptsInDirectory path >>= goScripts path
213213
MigrationScript name contents ->
@@ -250,7 +250,7 @@ checkScript con tableName name checksum =
250250
return (ScriptModified actualChecksum)
251251
where
252252
q = mconcat
253-
[ "select checksum from " <> Query tableName <> " "
253+
[ "select checksum from " `mappend` Query tableName `mappend` " "
254254
, "where filename = ? limit 1"
255255
]
256256

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

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

0 commit comments

Comments
 (0)