From fc8f671e3d556a9f5748babebd94837a0b4f6334 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Thu, 26 May 2022 16:13:30 -0600 Subject: [PATCH] fix migration issues --- src/Application.hs | 13 +++---------- src/Migration.hs | 4 ++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/Application.hs b/src/Application.hs index 55d1995..e774b17 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -150,18 +150,11 @@ makeFoundation appSettings = do stopEosWatch <- runLoggingT (runReaderT (watchEosRepoRoot pool) appSettings) logFunc + runSqlPool + (Database.Persist.Migration.Postgres.runMigration Database.Persist.Migration.defaultSettings manualMigration) + pool -- Preform database migration using application logging settings runLoggingT (runSqlPool (runMigration migrateAll) pool) logFunc - `UnliftIO.catch` (\(e :: SomeException) -> do - print e - runSqlPool - (Database.Persist.Migration.Postgres.runMigration - Database.Persist.Migration.defaultSettings - manualMigration - ) - pool - runLoggingT (runSqlPool (runMigration migrateAll) pool) logFunc - ) -- Return the foundation return $ mkFoundation pool stopEosWatch diff --git a/src/Migration.hs b/src/Migration.hs index 5cacf51..268e0ce 100644 --- a/src/Migration.hs +++ b/src/Migration.hs @@ -26,9 +26,9 @@ migration_0_2_0 = populateMetadata :: Operation populateMetadata = RawOperation "Populating Metadata" - $ migrateTitles + $ migrateMetadata <<$>> rawSql "SELECT pkg_id, title, desc_short, desc_long, icon_type FROM pkg_record" [] where - migrateTitles (Single id', Single title', Single descShort', Single descLong', Single iconType') = MigrateSql + migrateMetadata (Single id', Single title', Single descShort', Single descLong', Single iconType') = MigrateSql "UPDATE version SET title = ?, desc_short = ?, desc_long = ?, icon_type = ? where pkg_id = ?" [PersistText title', PersistText descShort', PersistText descLong', PersistText iconType', PersistText id']