Vacuum once after all migrations have been completed. (#2972)

This commit is contained in:
Chris Penner 2022-03-07 16:15:21 -06:00 committed by GitHub
parent 34791ed870
commit d70168f2b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -52,6 +52,9 @@ ensureCodebaseIsUpToDate localOrRemote root conn codebase = UnliftIO.try do
liftIO . putStrLn $ "🔨 Migrating codebase to version " <> show v <> "..."
migration conn codebase
when ((not . null) migrationsToRun) $ do
-- Vacuum once now that any migrations have taken place.
liftIO $ putStrLn $ "Cleaning up..."
liftIO . flip runReaderT conn $ Q.vacuum
liftIO . putStrLn $ "🏁 Migration complete. 🏁"
-- | Copy the sqlite database to a new file with a unique name based on current time.

View File

@ -149,8 +149,6 @@ migrateSchema1To2 conn codebase = do
runDB conn (liftQ Q.garbageCollectWatchesWithoutObjects)
liftIO $ putStrLn $ "Updating Schema Version..."
runDB conn . liftQ $ Q.setSchemaVersion 2
liftIO $ putStrLn $ "Cleaning up..."
runDB conn (liftQ Q.vacuum)
pure $ Right ()
where
withinSavepoint :: (String -> m c -> m c)