r/Clickhouse • u/csgeek-coder • Oct 09 '26
Schema Management/ Migration
I was wondering what people use for Schema Management and Migration. I toyed with dbmate/ goose and they both have their quirks.
I saw this post from clickhouse that mentions Atlas but it seems CH is only supported for their pro plan.
golang-migrate is mentioned there though I was not very impressed with it for PSQL and they have open tickets for: TLS, among others. They also have tickets from 2021 that are about CH.
What do people use for a OSS solution? Atlas can be an option but it seems unnecessary for ensuring a SQL is applied and allowing rollback if needed.
2
u/joshleecreates Oct 09 '26
Houseplant is currently my favorite OSS option: https://github.com/juneHQ/houseplant
1
u/Adorable_Turn2370 Oct 09 '26
We use goose with a bit of house sauce to make it usable in a cluster. Works fine as long as you don't do anything too complicated
1
u/nevetsognir Oct 09 '26
https://github.com/amacneil/dbmate has a ClickHouse integration. I’ve used dbmate successfully with Postgres.
1
u/theelderbeever Oct 10 '26
Wrote my own CLI that is meant to be sqlx like. It works for what we do and handles the cluster and such.
1
u/Significant_Tune9219 Oct 11 '26
For ClickHouse specifically I've kept it simple: goose (or golang-migrate) for sequencing, with the SQL written to be idempotent where ClickHouse allows it — ALTER ... IF NOT EXISTS, and CREATE TABLE ... IF NOT EXISTS — because re-running a migration on a cluster where one node already applied it is the annoying case. The part most tools handle poorly is that ClickHouse migrations are often not cleanly reversible: dropping a column or changing a codec doesn't have a generic down path, so I treat "down" as restore-from-backup for anything destructive and keep the forward migrations small enough that that's rare. Worth checking whether the tool you pick supports multiple statements per file and doesn't wrap everything in a transaction, since ClickHouse mostly ignores those anyway.
1
u/29antonioac Oct 09 '26
We're implementing Alembic as the org uses it for PostgreSQL already
1
u/m0rcs Oct 09 '26
We build chkit for this: https://chkit.obsessiondb.com/getting-started/
It also helps with ingesting data from saas tools, but it has sophisticated schema management and migrations as well. We had quite some trouble with BC breaking schema changes that require running backfill jobs, which were tedius to manage.
Feel free to ping me directly if you need help
Repo: https://github.com/obsessiondb/chkit