From e2ea68305e14955a117c9082596d77bcec96fa61 Mon Sep 17 00:00:00 2001 From: Andre Van Der Merwe Date: Sat, 12 Oct 2019 11:56:32 +0200 Subject: [PATCH] Using `mappend` rather than <> for compatability Not very pretty... --- src/Database/PostgreSQL/Simple/Migration.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Database/PostgreSQL/Simple/Migration.hs b/src/Database/PostgreSQL/Simple/Migration.hs index eef6b5a..b011e81 100644 --- a/src/Database/PostgreSQL/Simple/Migration.hs +++ b/src/Database/PostgreSQL/Simple/Migration.hs @@ -174,7 +174,7 @@ 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. @@ -182,7 +182,7 @@ 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() " @@ -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 -> @@ -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" ] @@ -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'.