---
title: "How to Deploy Schema Changes to a Million Databases"
description: "Database-per-tenant schema migrations can scale to millions of databases by inverting control: a hosted schema registry stores a versioned catalog of SQL scripts, and each client periodically reports its schema version, pulls the missing migrations and applies them locally."
url: "https://swe.quest/articles/how-to-deploy-schema-changes-to-a-million-databases-356cdf3f01c11d17"
canonical: "https://turso.tech/blog/how-to-deploy-schema-changes-to-a-million-databases"
source: "Turso"
published: "2025-06-02"
difficulty: "medium"
kind: "How-to"
reading_minutes: 4
tags: ["schema-migrations","multi-tenancy","sqlite","local-first","go"]
---

# How to Deploy Schema Changes to a Million Databases

A post on [Turso](https://swe.quest/sources/turso.md), published 2025-06-02, 4 min read, How-to. Original: [https://turso.tech/blog/how-to-deploy-schema-changes-to-a-million-databases](https://turso.tech/blog/how-to-deploy-schema-changes-to-a-million-databases)

## Summary

Database-per-tenant schema migrations can scale to millions of databases by inverting control: a hosted schema registry stores a versioned catalog of SQL scripts, and each client periodically reports its schema version, pulls the missing migrations and applies them locally. The registry needs only a simple migrations table, with no per-tenant state or distributed locks. Check-in timing (before critical operations, daily, or on user workflows) trades consistency against performance. The pull model suits offline-first apps that reconnect several versions behind, and a proof-of-concept is written in Go with SQLite.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Schema migrations](https://swe.quest/tags/schema-migrations.md) (Data & databases)
- [Multi-tenancy](https://swe.quest/tags/multi-tenancy.md) (Architecture & design)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [Local-first & sync](https://swe.quest/tags/local-first.md) (Architecture & design)
- [Go](https://swe.quest/tags/go.md) (Languages)

## Prerequisites

- SQL schema migrations ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- database-per-tenant architecture ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

Turso, SQLite, schema registry, Go

## Related posts

- [The Many-Database Architecture: Should You Give Every Tenant Their Own Database?](https://swe.quest/articles/the-many-database-architecture-should-you-give-every-tenant-their-own-database-8b8e22af8a8401bd.md): Turso · 2026-10-14 · Medium · 8 min read · Multi-tenancy, SQLite, System design, Databases, Privacy
  Shared schema with row-level security, schema per tenant, and database per tenant trade off isolation strength against operational cost.
- [Analytics for Per-User Database Architecture](https://swe.quest/articles/analytics-for-per-user-database-architecture-e1fb21767d74af7d.md): Turso · 2024-11-18 · Medium · 4 min read · Multi-tenancy, SQLite, Data pipelines, Analytics & OLAP, SQL
  Aggregating analytics across a database-per-tenant SQLite architecture works with a simple daily ETL job: discover tenant databases via the Turso Platform API, run a per-database query for daily orders, revenue, active carts and new products, and upsert the results into a central metrics table keyed by date and database name.
- [Database-per-User Architecture With Shared Application Environments: How and Why](https://swe.quest/articles/database-per-user-architecture-with-shared-application-environments-how-and-why-75dc31cab7b5ea77.md): Neon · 2024-10-18 · Medium · 8 min read · Multi-tenancy, PostgreSQL, System design, Schema migrations
  A single shared application environment serving many per-customer Neon Postgres databases keeps deployment simple, but every tenant database must stay at the same schema version and data residency is hard to offer.
- [Skip the API, Ship Your Database](https://swe.quest/articles/skip-the-api-ship-your-database-848af5fd83020408.md): Fly.io · 2023-09-13 · Medium · 5 min read · SQLite, API design, Replication, Multi-tenancy, System design
  Instead of designing an API for internal services, Fly.io ships them a read-only SQLite replica via LiteFS, letting consumers query and join data with plain SQL.
- [Breaking up a monolith: How we’re unwinding a shared database at scale](https://swe.quest/articles/breaking-up-a-monolith-how-we-re-unwinding-a-shared-database-at-scale-4f34dacf50e040a9.md): Datadog Engineering · 2025-06-17 · Medium · 20 min read · PostgreSQL, Schema migrations, Refactoring & migrations, Microservices, Replication
  Datadog is splitting its large shared Postgres database into independently owned instances through a three-phase plan: logical separation into per-domain private schemas with explicit ACLs, access reduction so only owning teams query their tables directly, and physical separation onto managed OrgStore instances.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
