summary refs log tree commit diff
path: root/litterbox.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-05-21 12:19:27 -0400
committerJune McEnroe <june@causal.agency>2020-05-21 12:19:27 -0400
commit62e20dea651bc2db8b8d491d449d0b0241ad42c4 (patch)
tree5d43eb9efd380e41b6141447864a45b0bc9b5371 /litterbox.c
parentDon't install rc scripts on other platforms (diff)
downloadlitterbox-62e20dea651bc2db8b8d491d449d0b0241ad42c4.tar.gz
litterbox-62e20dea651bc2db8b8d491d449d0b0241ad42c4.zip
Automatically perform database migrations in litterbox
To simplify upgrades, restarting litterbox should be sufficient. The
database can still be explicitly migrated with -m.
Diffstat (limited to 'litterbox.c')
-rw-r--r--litterbox.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/litterbox.c b/litterbox.c
index 632549a..808b565 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -793,17 +793,12 @@ int main(int argc, char *argv[]) {
 		dbInit();
 		return EX_OK;
 	}
-	if (migrate) {
-		dbMigrate();
-		return EX_OK;
-	}
 	if (backup) {
 		dbBackup(backup);
 		return EX_OK;
 	}
-	if (dbVersion() != DatabaseVersion) {
-		errx(EX_CONFIG, "database out of date; migrate with -m");
-	}
+	dbMigrate();
+	if (migrate) return EX_OK;
 	createJoins();
 
 	if (!host) errx(EX_USAGE, "host required");