summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-12-19 16:58:25 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-12-19 16:58:25 +0000
commit38959c45ea708597b7c1673f8dec3eb03b72a607 (patch)
tree02c4e9d6752873b0f139072958bf33f2eda57151 /src
parent73371a432b2b362e3d3487ca7cec8d44e9f6af01 (diff)
downloadrspamd-38959c45ea708597b7c1673f8dec3eb03b72a607.tar.gz
rspamd-38959c45ea708597b7c1673f8dec3eb03b72a607.zip
Add create database sql statements.
Diffstat (limited to 'src')
-rw-r--r--src/libserver/fuzzy_backend.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libserver/fuzzy_backend.c b/src/libserver/fuzzy_backend.c
index 8bd5cf469..2d33c4b92 100644
--- a/src/libserver/fuzzy_backend.c
+++ b/src/libserver/fuzzy_backend.c
@@ -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);
}