A walkthrough of managing schema migrations across multiple Neon Postgres databases in a database-per-tenant architecture. The approach uses three custom scripts: a create script to provision new Neon projects via the Neon API, a generate script that auto-creates DrizzleORM config files, generates migration files, stores connection strings as GitHub secrets, and updates the GitHub Actions workflow, and a migrate script triggered on PR merge that applies the same schema to all tenant databases. The solution handles both onboarding new tenants and rolling out schema changes to all existing databases simultaneously.

8m read timeFrom neon.com
Post cover image
Table of contents
What is Database Per Tenant?A Method For Schema MigrationsFinished