
Unlock this content
Enter your email to unlock this content for free
Tinybird is not affiliated with, associated with, or sponsored by ClickHouse, Inc. ClickHouse® is a registered trademark of ClickHouse, Inc.
Migration Patterns
Common migration patterns for safely evolving ClickHouse schemas include expand and contract (for renames and type changes), branch + exchange (for full rewrites), and versioning + canary (for testing in production). These patterns help you safely execute schema changes while maintaining system availability and data consistency.
Expand and Contract
The expand and contract pattern is a safe way to rename columns or change data types. You add a new column with the desired name or type, update ingestion to write to both columns, validate the change, and then drop the old column.
Phase 1: Expand (Add New Column)
ALTER TABLE events ADD COLUMN new_column_name NewDataType DEFAULT defaultValue;Phase 2: Migrate (Write to Both)
-- Update ingestion to write to both columns