dbmate
dbmate copied to clipboard
Clickhouse schema_migrations table doesn't support cluster wide replication
My migrations look like this
CREATE TABLE company_db.events ON CLUSTER 'company_cluster' (
time DateTime,
uid Int64,
type LowCardinality(String)
)
ENGINE = ReplicatedMergeTree('/clickhouse/tables/{cluster}/{shard}/table', '{replica}')
PARTITION BY toDate(time)
ORDER BY (uid);
After running the migration I'm expecting schema_migrations
table to be replicated across the cluster , So that I've a consistent schema migration information across cluster
golang-migrate solved this issue by specifying x-cluster-name
query parameter in DSN string.
Seems it wouldn't be hard to add such support in dbmate, just need some cluster to test against. Is there a nice way to spin up a cluster on a local machine?
You can easily spin up a cluster on local machine using docker compose. Please check this repo https://github.com/tetafro/clickhouse-cluster for reference.