Skip to content

Commit 16cb313

Browse files
author
Nikolay Ermolovich
committed
fix for create table engine ReplicatedReplacingMergeTree
1 parent 555501f commit 16cb313

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

database/clickhouse/clickhouse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ func (ch *ClickHouse) ensureVersionTable() (err error) {
248248
) Engine=%s`, ch.config.MigrationsTable, ch.config.MigrationsTableEngine)
249249
}
250250

251-
if strings.HasSuffix(ch.config.MigrationsTableEngine, "Tree") {
252-
query = fmt.Sprintf(`%s ORDER BY sequence`, query)
251+
if strings.Contains(ch.config.MigrationsTableEngine, "Tree") {
252+
query = fmt.Sprintf(`%s PRIMARY KEY sequence ORDER BY sequence`, query)
253253
}
254254

255255
if _, err := ch.conn.Exec(query); err != nil {

0 commit comments

Comments
 (0)