
Unlock this content
Enter your email to unlock this content for free
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: