diff options
author | June McEnroe <june@causal.agency> | 2020-07-08 13:01:06 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-08 13:01:06 -0400 |
commit | e34558412ae4b45e99d5efc25e0d9a47a97e1669 (patch) | |
tree | 21b53548ef4adb603c95052dce226ab08775fdbe /database.h | |
parent | Allocate enough bind space for :open and :close (diff) | |
download | litterbox-e34558412ae4b45e99d5efc25e0d9a47a97e1669.tar.gz litterbox-e34558412ae4b45e99d5efc25e0d9a47a97e1669.zip |
Convert timestamps to unix epoch time
This saves 125 MB on my own database after VACUUM.
Diffstat (limited to '')
-rw-r--r-- | database.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/database.h b/database.h index a0cba04..fb59140 100644 --- a/database.h +++ b/database.h @@ -42,7 +42,7 @@ #define DATABASE_PATH "litterbox/litterbox.sqlite" -enum { DatabaseVersion = 3 }; +enum { DatabaseVersion = 4 }; #define ENUM_TYPE \ X(Privmsg, "privmsg") \ @@ -323,7 +323,7 @@ static const char *InitSQL = SQL( UNIQUE (host, port) ); - PRAGMA user_version = 3; + PRAGMA user_version = 4; COMMIT TRANSACTION; ); @@ -363,6 +363,13 @@ static const char *MigrationSQL[] = { CREATE INDEX eventsTime ON events (time); PRAGMA user_version = 3; ), + + SQL( + UPDATE motds SET time = strftime('%s', time); + UPDATE topics SET time = strftime('%s', time); + UPDATE events SET time = strftime('%s', time); + PRAGMA user_version = 4; + ), }; static inline void dbMigrate(void) { |