mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-21 15:28:15 +03:00
Only set wal after vacuum-into copies
This commit is contained in:
parent
38b778009d
commit
24b5f17338
@ -104,7 +104,6 @@ openConnection name file = do
|
||||
_ -> "file:" <> file <> "?mode=ro"
|
||||
conn0 <- Sqlite.open sqliteURI `catch` rethrowAsSqliteConnectException name file
|
||||
let conn = Connection {conn = conn0, file, name}
|
||||
execute conn [Sql.sql| PRAGMA journal_mode = wal |]
|
||||
execute conn [Sql.sql| PRAGMA foreign_keys = ON |]
|
||||
execute conn [Sql.sql| PRAGMA busy_timeout = 60000 |]
|
||||
pure conn
|
||||
|
@ -783,3 +783,6 @@ copyCodebase src dest = liftIO $ do
|
||||
createDirectoryIfMissing True (makeCodebaseDirPath dest)
|
||||
withConnection ("copy-from:" <> src) src $ \srcConn -> do
|
||||
Sqlite.vacuumInto srcConn (makeCodebasePath dest)
|
||||
-- We need to reset the journal mode because vacuum-into clears it.
|
||||
withConnection ("copy-to:" <> dest) dest $ \destConn -> do
|
||||
Sqlite.trySetJournalMode destConn Sqlite.JournalMode'WAL
|
||||
|
@ -192,5 +192,8 @@ backupCodebaseIfNecessary backupStrategy localOrRemote conn currentSchemaVersion
|
||||
| otherwise -> do
|
||||
backupPath <- getPOSIXTime <&> (\t -> root </> backupCodebasePath currentSchemaVersion t)
|
||||
Sqlite.vacuumInto conn backupPath
|
||||
-- vacuum-into clears the journal mode, so we need to set it again.
|
||||
Sqlite.withConnection "backup" backupPath \backupConn -> do
|
||||
Sqlite.trySetJournalMode backupConn Sqlite.JournalMode'WAL
|
||||
putStrLn ("📋 I backed up your codebase to " ++ (root </> backupPath))
|
||||
putStrLn "⚠️ Please close all other ucm processes and wait for the migration to complete before interacting with your codebase."
|
||||
|
Loading…
Reference in New Issue
Block a user