Loading...
Loading...
ClickHouse migration patterns and rules. Use when creating or modifying ClickHouse migrations.
npx skill4agent add posthog/posthog clickhouse-migrationsposthog/clickhouse/migrations/AGENTS.mdoperations = [
run_sql_with_exceptions(
SQL_FUNCTION(),
node_roles=[...],
sharded=False, # True for sharded tables
is_alter_on_replicated_table=False # True for ALTER on replicated tables
),
][NodeRole.DATA][NodeRole.DATA, NodeRole.COORDINATOR][NodeRole.INGESTION_SMALL]AggregatingMergeTree(table, replication_scheme=ReplicationScheme.SHARDED)ReplacingMergeTree(table, replication_scheme=ReplicationScheme.REPLICATED)CollapsingMergeTreeReplacingMergeTreeDeletedDistributed(data_table="sharded_events", sharding_key="sipHash64(person_id)")Distributed(data_table="my_table", cluster=settings.CLICKHOUSE_SINGLE_SHARD_CLUSTER)ON CLUSTERIF EXISTSIF NOT EXISTSDROP TABLE IF EXISTS ... SYNCon_cluster=Falsesharded=Trueis_alter_on_replicated_table=Trueinfi_clickhouse_orm_migrations