Local Development and Database Branching // a more collaborative Supabase workflow 🚀
HTML-код
- Опубликовано: 12 июл 2024
- Day 2 - Supabase Local Dev: migrations, branching, and observability: supabase.com/blog/supabase-lo...
Database Branching allows an ephemeral database to be created for every Git branch. This means entirely separate databases for Local Development, Preview, and Production.
In this video, Jon Meyers shows off some new Supabase CLI commands that make database migrations simple - inspecting the difference between two databases and generating the SQL required to migrate. Additionally, he explains the theory behind the new Database Branching feature, which automates the cloning of databases for new features and demonstrates how changes can be merged into production.
00:00 Introduction
00:16 Overview of Production Supabase project
00:30 Create Local Supabase project
01:39 Clone structure of Production to Local database
02:54 Clone seed data from Production to Local database
03:47 Database Branching
05:28 What are you going to build? Наука
Check out everything else that was shipped during Supabase Launch Week: supabase.com/launch-week
Also watch how to use Hugging Face models with Supabase in Python or Typescript: ruclips.net/video/RJccSbJ9Go4/видео.html
These videos make Supabase even better! Keep them up
Thanks a lot, we are very lucky to have Jon in our team!
@@Supabase Pixel density of Jon increases on every Launch Week video.
We will! 🚀
I love this feature 😍😍😍😍😍😍😍😍 But we need more videos and tutorials to understand exactly how it works. Can you create DEV, STAGGING AND PROD?
I cant wait to have it released to the public. This is a game changer. Very interesting. These toolings are next level.
Love your guides!! Awesome feature
This is so cool, I wish I had this few months ago when I had to manually create a duplicate project for production
Good thing you have it for every future project! 🚀
Holy damn, these are some sick features and a very nice explanation!
ok that's pretty amazing
😱
It sure is! ☝️
Holy shit , an up to date supabase video
so does this mean we can essentially get rid of having 2 supabase projects (prod + staging) and just use preview builds instead?
crossing my fingers that the answer to your question is yes
Yep 😁
One of the main use cases we are building Branching for is so that you no longer need separate Supabase projects for different development environments.
@@codewrangler 🤞it’s a yes 👍
@@JonathanSummersMuir really good to hear. I’m kind of curious, was it partially inspired by vercel and how they have preview builds per branch?
@@wata1991 Yep, partly inspired by Vercel/Netlify as jam-stack developers will naturally want to connect their apps to preview based backends - Maybe they'll be some more news on that later this week 👀.
this is really awesome.
awesome feature..
What about testing environment? How can I create one more env which is a copy of prod with different data and it can be used by testers before merge to production?
Went real fast at the end there lol
Does this also grabs all the Postgres functions, triggers and ebge functions ?
I'm guessing your referring to Branching.
Yep, Postgres functions and triggers will be in the Preview Branches if they are in the migration files.
Edge functions is an interesting topic as the source code for those are probably in your git repository, so we _could_ provide some automation to deploy them automatically for you to the Preview Branch Supabase instance. The GitHub integration is a work in progress right now, but this was one of the ideas we had.
@@jonathansummers-muir1317 thanks
Great info here. For anyone trying to do db remote commit and then use it locally. For whatever reason, I ran into errors, I had to comment out several create schema lines for graphql, pgsodium, pg_temp_10, pg_toast_temp_10. I tried doing db reset and it tries to run this migration and fails because some of those schemas already existed. I then moved the migration file, did db reset, then moved file back and db reset, same error. So, just comment out the stuff that already exists I guess is the path forward.
Can’t wait for y’all to have a terraform provider so I can manage this along with the rest of my infra. Until then, I have to make do with neon 😢
No shade.
I just don’t think that it’s practical to try to buy in to outsourcing all of your concerns to SaaS’s if you can manage them all primarily through a unified control plane. Click-ops/cli ops gives you too many foot guns when you’ve outsourced your concerns to 15 different vendors.
Hello @Supabase, could you give us clarity when database branching becomes available?
Thanks for sharing!! Got pretty close with this one but I'm running into the following error when running `npx supabase db dump --data-only -f supabase/seed.sql`
pg_dump: error: query failed: ERROR: permission denied for table hooks
pg_dump: detail: Query was: LOCK TABLE "supabase_functions"."hooks" IN ACCESS SHARE MODE
Is it possible to have that same workflow with self-hosted supabase?
I'm also curious to know
Any idea on when/if bitbucket will be supported in the future?
We’re focusing on GitHub for alpha release, but will roll out to other providers as soon as we can!
can't able to paste token in vs code..
so how I do it?
How do we work on multiple local projects on the same machine?
Bumped into migration errors between local & remote
We want a full tutorial with nextjs or nodejs
Too late bro, already switched to planetscale
Ohhhh. Do they have a terraform provider, too? 🎉
Logo changed green was better i think
Purple is our Launch Week brand! The green will return!
Vercel does this too
So this is just migrations, you achieve something similar with code tbh
Lol come on, guys. This video is 11 days old. Following the instructions gives a "db commit is deprecated, use db pull instead." I got it to work fine after restarting but it's not a good look when your content team can't even get a heads up from the devs that they're putting out tutorials that are obsoleted within a fortnight.
Hardly, the command told you the fix
They’re moving fast, read the docs
Most people are building with nocode, so this video is not helpful.
Wouldn't be so sure about that 😄
"most" is a stretch. But I hope that something you find more useful is released soon!
Corrected: *people are building with no effort, so this video is not helpful.
Most people who use no code end up getting to a scenario where they need to write code.
This is why platforms like Webflow, FlutterFlow and EditorX end up allowing you to write code. Because no-code sucks for anything that isn't generic boilerplate.
Like setting up a new db could have been done within supabase instead of command line.
supabase db dump --data-only -f supabase/seed.sql
Dumping data from remote database...
pg_dump: warning: there are circular foreign-key constraints on this table:
pg_dump: detail: key
In extension pgsodium 😕