惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
GbyAI
GbyAI
M
MIT News - Artificial intelligence
美团技术团队
罗磊的独立博客
雷峰网
雷峰网
量子位
博客园 - 【当耐特】
Last Week in AI
Last Week in AI
D
Docker
小众软件
小众软件
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
WordPress大学
WordPress大学
V
V2EX
博客园_首页
腾讯CDC
The Cloudflare Blog
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

Supabase Blog

AI Agents Know About Supabase. They Don't Always Use It Right. Custom OIDC Providers for Supabase Auth 100,000 GitHub stars Supabase docs over SSH Navigating Regional Network Blocks Supabase Joins the Stripe Projects Developer Preview Log Drains: Now available on Pro Supabase Storage: major performance, security, and reliability updates Supabase incident on February 12, 2026 Hydra joins Supabase X / Twitter OAuth 2.0 is now available for Supabase Auth BKND joins Supabase Supabase is now an official Claude connector Supabase PrivateLink is now available Introducing: Postgres Best Practices When to use Read Replicas vs. bigger compute Introducing TRAE SOLO integration with Supabase Supabase Security Retro: 2025 Sync Stripe Data to Your Supabase Database in One Click Building ChatGPT Apps with Supabase Edge Functions and mcp-use Own Your Observability: Supabase Metrics API Introducing iceberg-js: A JavaScript Client for Apache Iceberg Introducing Supabase for Platforms Adding Async Streaming to Postgres Foreign Data Wrappers Build "Sign in with Your App" using Supabase Auth Introducing Seven New Email Templates for Supabase Auth The new Supabase power for Kiro Introducing Supabase ETL Introducing Analytics Buckets Introducing Vector Buckets
Supabase Branching
Qiao Han, Jonny Summers-Muir · 2023-12-13 · via Supabase Blog

Supabase Branching

A few months ago we mentioned that we were working on Branching with a (somewhat ambitious) early-access form.

Today we are rolling out access to early-access subscribers. Internally, we were hoping to make this public access for this Launch Week but, well, we did say this was hard.

We're operating on a first-signed-up, first-served basis, rolling it out in batches to paid orgs who registered for early access.

At some point during development, you will probably need to experiment with your Postgres database. Today that's possible on your local development machine using the Supabase CLI. When you run supabase start with the CLI to get the entire Supabase stack running locally. You can play around with ideas and run supabase db reset whenever you want to start again. When you want to capture your changes in a database migration, you can run supabase db diff.

Branching is a natural extension of this, but instead of experimenting with just a local database you also get remote database. You continue to use the workflow above, and then when you commit your changes to Git we'll run them on a Supabase Preview Branch.

Each Git branch has a corresponding Supabase Preview, which automatically updates whenever you push an update. The rest of the workflow should feel familiar: when you merge a Pull Request into your main Git branch, Supabase will run your database migrations inside your Production database.

Your project's Preview Branches are designed with safety in mind. They are isolated instances, each with a distinct set of API keys and passwords. Each instance contains every Supabase feature: a Postgres database, Auth, File Storage, Realtime, Edge Functions, and Data APIs.

Even in relaxed developer environments, if one of your team accidentally leaks a key it won't affect your Production branch.

Support for Vercel Previews#

We've designed Supabase Branching to work perfectly with Vercel's Preview deployments. This means that you get an entire stack with Branching.

We've made several improvements to our Vercel Integration to make the Vercel experience seamless. For example, since we provide distinct, secure database credentials for every Supabase Preview Branch, we automatically populate the environment variables on Vercel with the connection secrets your app needs to connect to the Preview Branch.

Developing on the hosted Preview Branch#

One of the most-loved features of Supabase is the dashboard. Even if we beg, it seems that developers simply want to use it for everything - even in production.

The cool thing about Branching is that every Supabase Preview can be managed from the Dashboard. You can make schema changes, access the SQL Editor, and use the new AI Assistant. Once you're happy with your changes, you simply run supabase db diff on your local machine to pull the changes and you can commit them to Git.

Just note that we still want you to develop locally! You should treat the Preview Branches like cattle, not pets. Your Preview changes can be wiped at any time if one of your team pushes a destructive migration.

Database migrations#

We've developed Branching to work with a Git provider, starting with GitHub.

Our GitHub app observes changes within a connected GitHub repository. When you open a Pull Request, it launches a Preview Branch and runs the migrations in ./supabase/migrations. If there are any errors they are logged to the Check Run associated with that git commit. When all checks turn green, your new Preview Branch is ready to use.

When you push a new migration file to the Git branch, the app runs it incrementally in your Preview Branch. This allows you to verify schema changes easily on existing seed data.

Finally, when you merge that PR, the app runs the new migrations on your Production environment. If you have other PRs already open, make sure to update those migration files to a later timestamp than the ones in the Production branch following a standard migration practice.

Data seeding#

You can seed your Preview branch in the same way that you seed your local development environment. Just add ./supabase/seed.sql in your repo and the seed script will run when the Preview Branch is created.

Optionally, you can reset the database by running supabase db reset --db-url <branch-connection-string />. The branch connection string can be retrieved using your Personal Access Token with Supabase CLI's branch management commands.

We're investigating data masking techniques with a copy-on-write system so that you can emulate a production workload inside your Preview Branches. We plan for this to work with File Storage too.

That's already a lot for Branching v0. Branching will be a core part of the developer workflow in the future. These are the themes we'll explore next:

Declarative config#

We're still working on “configuration in code”. For example, you might want to try a different Google Auth in your Preview Branch than the one you use in Product. This would be a lot easier if the code was declarative, inside the config.toml file.

Automatic dashboard commits#

In the current version, when you use the dashboard to create a change on a Preview Branch, you need to run db diff locally to pull that change into your Git repository. We plan to work on a feature to automatically capture your changes in a Git repo that you've connected.

Extended seeding behavior#

There are a multitude of different strategies for populating seed data. We've dabbled with AI to generate seed data, which was fun. We also like the approach of postgresql-anonymizer and Snaplet, which specialize in cloning production data while anonymizing the data for safe development.

Copy-on-write#

We have something in development :). CoW means you can branch from database snapshot and then run tests on “production-like” workloads. This is the approach that Postgres.ai uses. As we mentioned above, we need to figure out an approach that also works with File Storage.

We'll be onboarding organizations in batches over the next few weeks, and working with these early users on Pricing.

Update 17th January 2024 - Early access for Branching is now closed for the foreseeable future. We are now working hard towards releasing a public beta.

Check out the Branching docs and also if you have any feedback, you can join the discussion.