diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-22 13:15:52 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-22 13:15:52 +0000 |
commit | ed0431f6b6cd24e50fcb8bb9246ad802bbf0aa8c (patch) | |
tree | 3ca508323a1b99ffa28197de020bae93559144aa | |
parent | 6e571d7929b3a5c37f0f31e53ab030b7b44c7130 (diff) | |
download | rspamd-ed0431f6b6cd24e50fcb8bb9246ad802bbf0aa8c.tar.gz rspamd-ed0431f6b6cd24e50fcb8bb9246ad802bbf0aa8c.zip |
[Fix] Clickhouse: Fix table schema upload
-rw-r--r-- | src/plugins/lua/clickhouse.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua index 6fc611cef..924b629c8 100644 --- a/src/plugins/lua/clickhouse.lua +++ b/src/plugins/lua/clickhouse.lua @@ -115,7 +115,7 @@ CREATE TABLE rspamd ) ENGINE = MergeTree(Date, (TS, From), 8192) ]], [[CREATE TABLE rspamd_version ( Version UInt32) ENGINE = TinyLog]], -[[INSERT INTO rspamd_version (Version) Values (2)]], +[[INSERT INTO rspamd_version (Version) Values (${SCHEMA_VERSION})]], } -- This describes SQL queries to migrate between versions @@ -743,7 +743,11 @@ local function upload_clickhouse_schema(upstream, ev_base, cfg) end rspamd_logger.debugm(N, rspamd_config, 'uploaded clickhouse schema element %s to %s', v, upstream:get_addr():to_string(true)) - end, fun.chain(clickhouse_schema, settings.schema_additions)) + end, + -- Also template schema version + fun.map(function(v) + return lua_util.template(v, {SCHEMA_VERSION = tostring(schema_version)}) + end, fun.chain(clickhouse_schema, settings.schema_additions))) end local function maybe_apply_migrations(upstream, ev_base, cfg, version) |