]> source.dussan.org Git - rspamd.git/commitdiff
Add create database sql statements.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 19 Dec 2014 16:58:25 +0000 (16:58 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 19 Dec 2014 16:58:25 +0000 (16:58 +0000)
src/libserver/fuzzy_backend.c

index 8bd5cf46918b63f94932e7809aeec751d30aed21..2d33c4b92172baea96ebe41835265e9b90273522 100644 (file)
@@ -65,13 +65,24 @@ static struct rspamd_fuzzy_stmts {
 {
        {
                .idx = RSPAMD_FUZZY_BACKEND_CREATE,
-               .sql = "",
+               .sql = "CREATE TABLE digests("
+                               "id INTEGER PRIMARY KEY,"
+                               "flag INTEGER NOT NULL,"
+                               "digest TEXT NOT NULL,"
+                               "value INTEGER);"
+                               ""
+                               "CREATE TABLE shingles("
+                               "value INTEGER NOT NULL,"
+                               "number INTEGER NOT NULL,"
+                               "digest_id INTEGER REFERENCES digests(id) ON DELETE CASCADE"
+                               "ON UPDATE CASCADE);",
                .args = "",
                .stmt = NULL
        },
        {
                .idx = RSPAMD_FUZZY_BACKEND_INDEX,
-               .sql = "",
+               .sql = "CREATE UNIQUE INDEX d ON digests(digest, flag);"
+                               "CREATE UNIQUE INDEX s ON shingles(value, number);",
                .args = "",
                .stmt = NULL
        },
@@ -393,6 +404,7 @@ rspamd_fuzzy_backend_open (const gchar *path, GError **err)
                                close (fd);
                                return NULL;
                        }
+                       msg_info ("Old database converted");
                }
                close (fd);
        }