The datastore:// migration driver is now a self-contained golang-migrate database.Driver that opens through github.com/hanzo-ds/go (the native ClickHouse-wire driver registered as the database/sql name "datastore"). The ClickHouse-specific migration logic (multi-statement exec, schema_migrations DDL, cluster/engine config, Version/SetVersion/Drop/Lock) is ported directly into database/datastore, so it no longer embeds or imports the upstream database/clickhouse driver or github.com/ClickHouse/clickhouse-go. - Delete database/clickhouse (driver + test + examples) and internal/cli/build_clickhouse.go. - internal/cli/build_datastore.go drops the clickhouse-go blank import. - go.mod: drop github.com/ClickHouse/clickhouse-go, add github.com/hanzo-ds/go v1.0.1; tidy. Zero clickhouse-go in go.mod, go.sum, and the module/dependency graph. - Port the driver test + example migrations under database/datastore (integration test requires a live datastore/clickhouse-wire backend). - Update README, release workflow build tags, bug report template. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Datastore
datastore://host:port?username=user&password=password&database=clicks&x-multi-statement=true
Hanzo Datastore is a ClickHouse-wire-compatible database engine. This driver
connects through the native github.com/hanzo-ds/go driver, which registers the
database/sql driver name datastore.
| URL Query | Description |
|---|---|
x-migrations-table |
Name of the migrations table |
x-migrations-table-engine |
Engine to use for the migrations table, defaults to TinyLog |
x-cluster-name |
Name of cluster for creating schema_migrations table cluster wide |
x-multi-statement |
Enable multiple statements to be ran in a single migration (See note below) |
x-multi-statement-max-size |
Maximum size of a single migration in bytes when x-multi-statement is set (defaults to 10 MB) |
database |
The name of the database to connect to |
username |
The user to sign in as |
password |
The user's password |
host |
The host to connect to. |
port |
The port to bind to. |
Notes
- The Datastore driver does not natively support executing multiple statements in a single query. To allow for multiple statements in a single migration, you can use the
x-multi-statementparam. There are two important caveats:- This mode splits the migration text into separately-executed statements by a semi-colon
;. Thusx-multi-statementcannot be used when a statement in the migration contains a string with a semi-colon. - The queries are not executed in any sort of transaction/batch, meaning you are responsible for fixing partial migrations.
- This mode splits the migration text into separately-executed statements by a semi-colon
- Using the default TinyLog table engine for the
schema_migrationstable prevents backing up the table. If you need to back up the database, run the migrations withx-migrations-table-engine=MergeTree. - Datastore cluster mode is not officially supported, but you can try enabling
schema_migrationstable replication by specifying ax-cluster-name:- When
x-cluster-nameis specified,x-migrations-table-enginealso should be specified. - When
x-cluster-nameis specified, only theschema_migrationstable is replicated across the cluster. You still need to write your migrations so that the application tables are replicated within the cluster.
- When
- If you want to create a database inside a migration, note that the
schema_migrationstable will live in thedefaultdatabase, so you cannot useUSE <database_name>inside a migration. In this case you may omit the database in the connection string (example here).