diff --git a/Database/ContentIdentifier.hs b/Database/ContentIdentifier.hs index c531f915ea..4fdfd5b292 100644 --- a/Database/ContentIdentifier.hs +++ b/Database/ContentIdentifier.hs @@ -97,7 +97,7 @@ openDb :: Annex ContentIdentifierHandle openDb = do dbdir <- calcRepo' gitAnnexContentIdentifierDbDir let db = dbdir literalOsPath "db" - isnew <- liftIO $ not <$> doesDirectoryExist db + isnew <- liftIO $ not <$> doesFileExist db if isnew then initDb db $ void $ runMigrationSilent migrateContentIdentifier diff --git a/Database/Export.hs b/Database/Export.hs index 0ed6c126bb..71fbbec13d 100644 --- a/Database/Export.hs +++ b/Database/Export.hs @@ -97,7 +97,7 @@ openDb :: UUID -> Annex ExportHandle openDb u = do dbdir <- calcRepo' (gitAnnexExportDbDir u) let db = dbdir literalOsPath "db" - unlessM (liftIO $ doesDirectoryExist db) $ do + unlessM (liftIO $ doesFileExist db) $ do initDb db $ void $ runMigrationSilent migrateExport h <- liftIO $ H.openDbQueue db "exported" diff --git a/Database/Fsck.hs b/Database/Fsck.hs index 496903e0e4..50ba8f8c30 100644 --- a/Database/Fsck.hs +++ b/Database/Fsck.hs @@ -71,7 +71,7 @@ openDb :: UUID -> Annex FsckHandle openDb u = do dbdir <- calcRepo' (gitAnnexFsckDbDir u) let db = dbdir literalOsPath "db" - unlessM (liftIO $ doesDirectoryExist db) $ do + unlessM (liftIO $ doesFileExist db) $ do initDb db $ void $ runMigrationSilent migrateFsck lockFileCached =<< calcRepo' (gitAnnexFsckDbLock u) diff --git a/Database/ImportFeed.hs b/Database/ImportFeed.hs index 2d1611c73c..8820b84189 100644 --- a/Database/ImportFeed.hs +++ b/Database/ImportFeed.hs @@ -74,7 +74,7 @@ openDb :: Annex ImportFeedDbHandle openDb = do dbdir <- calcRepo' gitAnnexImportFeedDbDir let db = dbdir literalOsPath "db" - isnew <- liftIO $ not <$> doesDirectoryExist db + isnew <- liftIO $ not <$> doesFileExist db when isnew $ initDb db $ void $ runMigrationSilent migrateImportFeed diff --git a/Database/Keys.hs b/Database/Keys.hs index 686be30e13..cc3f189b99 100644 --- a/Database/Keys.hs +++ b/Database/Keys.hs @@ -129,7 +129,7 @@ openDb forwrite _ = do catchPermissionDenied permerr $ withExclusiveLock lck $ do dbdir <- calcRepo' gitAnnexKeysDbDir let db = dbdir literalOsPath "db" - dbexists <- liftIO $ doesDirectoryExist db + dbexists <- liftIO $ doesFileExist db case dbexists of True -> open db False False -> do diff --git a/Database/RepoSize.hs b/Database/RepoSize.hs index 93c6b1d5ba..d70de72191 100644 --- a/Database/RepoSize.hs +++ b/Database/RepoSize.hs @@ -106,7 +106,7 @@ openDb :: Annex RepoSizeHandle openDb = lockDbWhile permerr $ do dbdir <- calcRepo' gitAnnexRepoSizeDbDir let db = dbdir literalOsPath "db" - unlessM (liftIO $ doesDirectoryExist db) $ do + unlessM (liftIO $ doesFileExist db) $ do initDb db $ void $ runMigrationSilent migrateRepoSizes h <- liftIO $ H.openDb db "repo_sizes"