From: Vsevolod Stakhov Date: Fri, 19 Dec 2014 16:58:25 +0000 (+0000) Subject: Add create database sql statements. X-Git-Tag: 0.8.0~63 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=38959c45ea708597b7c1673f8dec3eb03b72a607;p=rspamd.git Add create database sql statements. --- 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); }