From 16cb3137a3e6e2e11de04585b66de26a584b6b8c Mon Sep 17 00:00:00 2001 From: Nikolay Ermolovich Date: Wed, 18 Sep 2024 22:36:26 +0500 Subject: [PATCH] fix for create table engine ReplicatedReplacingMergeTree --- database/clickhouse/clickhouse.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/clickhouse/clickhouse.go b/database/clickhouse/clickhouse.go index d2b65c0ce..71898c79d 100644 --- a/database/clickhouse/clickhouse.go +++ b/database/clickhouse/clickhouse.go @@ -248,8 +248,8 @@ func (ch *ClickHouse) ensureVersionTable() (err error) { ) Engine=%s`, ch.config.MigrationsTable, ch.config.MigrationsTableEngine) } - if strings.HasSuffix(ch.config.MigrationsTableEngine, "Tree") { - query = fmt.Sprintf(`%s ORDER BY sequence`, query) + if strings.Contains(ch.config.MigrationsTableEngine, "Tree") { + query = fmt.Sprintf(`%s PRIMARY KEY sequence ORDER BY sequence`, query) } if _, err := ch.conn.Exec(query); err != nil {