Skip to content

Commit

Permalink
Update clickhouse.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Rupreht authored Sep 19, 2024
1 parent 16cb313 commit 8efead9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions database/clickhouse/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,11 @@ func (ch *ClickHouse) ensureVersionTable() (err error) {
sequence UInt64
) Engine=%s`, ch.config.MigrationsTable, ch.config.MigrationsTableEngine)
}

if strings.Contains(ch.config.MigrationsTableEngine, "Tree") {
query = fmt.Sprintf(`%s PRIMARY KEY sequence ORDER BY sequence`, query)
// fix: https://github.com/golang-migrate/migrate/pull/1169/commits/16cb3137a3e6e2e11de04585b66de26a584b6b8c
// if strings.Contains(ch.config.MigrationsTableEngine, "Tree") {
// query = fmt.Sprintf(`%s PRIMARY KEY sequence ORDER BY sequence`, query)
if strings.HasSuffix(ch.config.MigrationsTableEngine, "Tree") {
query = fmt.Sprintf(`%s ORDER BY sequence`, query)
}

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

0 comments on commit 8efead9

Please sign in to comment.