version 0.3.32
[fms.git] / src / dbsetup.cpp
index 644310b..01858aa 100644 (file)
@@ -117,13 +117,19 @@ void SetupDB(SQLite3DB::DB *db)
                        major=1;\r
                        minor=16;\r
                }\r
+               if(major==1 && minor==16)\r
+               {\r
+                       ConvertDB0116To0117(db);\r
+                       major=1;\r
+                       minor=17;\r
+               }\r
        }\r
        else\r
        {\r
-               db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,16);");\r
+               db->Execute("INSERT INTO tblDBVersion(Major,Minor) VALUES(1,17);");\r
        }\r
 \r
-       db->Execute("UPDATE tblDBVersion SET Major=1, Minor=16;");\r
+       db->Execute("UPDATE tblDBVersion SET Major=1, Minor=17;");\r
 \r
        db->Execute("CREATE TABLE IF NOT EXISTS tblFMSVersion(\\r
                                Major                           INTEGER,\\r
@@ -320,6 +326,7 @@ void SetupDB(SQLite3DB::DB *db)
                                MessageUUID                     TEXT UNIQUE,\\r
                                ReplyBoardID            INTEGER,\\r
                                Body                            TEXT,\\r
+                               InsertDate                      DATE,\\r
                                MessageIndex            INTEGER,\\r
                                Read                            INTEGER CHECK(Read IN(0,1)) DEFAULT 0\\r
                                );");\r
@@ -431,7 +438,7 @@ void SetupDB(SQLite3DB::DB *db)
                                PostOrder               INTEGER\\r
                                );");\r
 \r
-       db->Execute("CREATE INDEX IF NOT EXISTS idxThreadPost_ThreadID ON tblThreadPost(ThreadID);");\r
+       db->Execute("CREATE UNIQUE INDEX IF NOT EXISTS idxThreadPost_ThreadMessage ON tblThreadPost(ThreadID,MessageID);");\r
        db->Execute("CREATE INDEX IF NOT EXISTS idxThreadPost_MessageID ON tblThreadPost(MessageID);");\r
 \r
        db->Execute("CREATE TRIGGER IF NOT EXISTS trgDeleteOnThread AFTER DELETE ON tblThread\\r