diff options
author | June McEnroe <june@causal.agency> | 2020-07-11 19:36:22 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-11 19:36:22 -0400 |
commit | 80187969f2471931dad161e398c8143b785f86f5 (patch) | |
tree | d8b71f6cdb71e73e7f6f80a45ce3b77c9813046f | |
parent | Increase line-height (diff) | |
download | scooper-80187969f2471931dad161e398c8143b785f86f5.tar.gz scooper-80187969f2471931dad161e398c8143b785f86f5.zip |
Check database version against a range
Diffstat (limited to '')
-rw-r--r-- | server.c | 2 | ||||
-rw-r--r-- | server.h | 5 |
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") \ |