Unlock this content

Enter your email to unlock this content for free

By continuing, you agree to our Terms of Service and Privacy Notice, and to receive occasional marketing emails.

Multi-Tenant Migration Example

TL;DR

This example demonstrates evolving a web analytics project to be multi-tenant using Tinybird Code. The process involves adding a tenant_id column, updating sorting keys, modifying all materialized views, and updating API endpoints, all handled automatically with a single command. Tinybird Code generates a migration plan, handles backfilling transparently using separate compute resources, and atomically switches the project once migrations complete.

The Project: Web Analytics Dashboard

Initial State

The project is a web analytics dashboard with:

  • Analytics events table: Source table with events
  • Materialized views: Aggregations for KPIs, top pages, locations, devices, sources, browsers
  • API endpoints: RESTful APIs for dashboard data
  • Dashboard: Visualizations showing analytics

Project Structure:

Tinybird is not affiliated with, associated with, or sponsored by ClickHouse, Inc. ClickHouse® is a registered trademark of ClickHouse, Inc.

Multi-Tenant Migration Example | ClickHouse for Developers