Skip to main content
This workflow helps you apply schema changes consistently across multiple tenant databases in a multi-tenant architecture. When you need to update the schema structure for all tenants, this workflow ensures every tenant database reaches the same desired schema state, even though each tenant may require different migration steps depending on their current state.
1

Prepare Template Schema

Create a master schema template that defines the desired state for all tenant schemas.
Review the schema file to ensure it contains all necessary changes and is ready for deployment across all tenants.
2

Preview Changes

Generate migration plans for each tenant to see what changes will be applied before execution.
Review the plans to ensure the changes are expected and safe for all tenants. The JSON plans can be used later with the --plan flag to ensure exactly the same migration steps are executed across all tenants.
3

Apply to Test Tenant

Validate the schema changes on a single test tenant before rolling out to all tenants.
Perform application testing on the test tenant to ensure functionality works as expected with the new schema. Note that each tenant may have different migration steps depending on their current schema state, but all will reach the same final desired state.
4

Roll Out to All Tenants

Apply the schema changes to all production tenant schemas.
For production environments, consider adding delays between tenant updates, monitoring for issues, and using the --lock-timeout flag to prevent long-running locks.
5

Verify Deployment

Confirm all tenant schemas have been updated to match the desired template state.
All tenants now have the same schema structure matching the template and are ready for application deployment.