go-gorm / clickhouse

GORM clickhouse driver
MIT License
243 stars 71 forks source link

Automigration doesn't work with table on cluster mode #113

Open EasonXeu opened 1 year ago

EasonXeu commented 1 year ago

Description

When I use gorm to operate the click house table which is running in the cluster mode, just like this:

database.db.Table(tableName).Set( "gorm:table_cluster_options", "on cluster hs_ch_cluster").AutoMigrate(&dto.User{})

The autoMigrate function is not working if we add new columns. I thought it is because the cluster clause is missing. The code is here.

The cluster clause is included in creating a table but is not included in adding a column. craeting table adding a column

And it seems that the issue exists for adding column, dropping column, and altering column

EasonXeu commented 1 year ago

I raised a PR here to fix this issue.

https://github.com/go-gorm/clickhouse/pull/117

EasonXeu commented 1 year ago

@jinzhu please help to review and merge