about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--server.c2
-rw-r--r--server.h5
2 files changed, 5 insertions, 2 deletions
diff --git a/server.c b/server.c
index 61e23bc..bed5d95 100644
--- a/server.c
+++ b/server.c
@@ -103,7 +103,7 @@ int main(int argc, char *argv[]) {
 	if (error != SQLITE_ROW) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db));
 
 	int version = sqlite3_column_int(check, 0);
-	if (version != DatabaseVersion) {
+	if (version < DatabaseVersionMin || version > DatabaseVersionMax) {
 		errx(EX_DATAERR, "unsupported database version %d", version);
 	}
 	sqlite3_finalize(check);
diff --git a/server.h b/server.h
index c3e274e..c04b871 100644
--- a/server.h
+++ b/server.h
@@ -34,7 +34,10 @@
 // Why does it return (const unsigned char *)?
 #define sqlite3_column_text(...) (const char *)sqlite3_column_text(__VA_ARGS__)
 
-enum { DatabaseVersion = 5 };
+enum {
+	DatabaseVersionMin = 4,
+	DatabaseVersionMax = 5,
+};
 
 #define ENUM_TYPE \
 	X(Privmsg, "privmsg") \