With Supabase Link we can link our local project to a remote database. Then we can use the command npx supabase db diff -f <fileName>
to create a local migration file.
Then we use npx supabase db push
to apply our local changes to the remote database.
[00:00] We need to link this project with our remote project, so we can say mpx supabase link. And you see it asked for the project ref, and so we need to run that command again. We'll say project ref, and then we'll give it the project ID. So if we come back into our remote database to our settings, [00:19] so we can get our reference ID. So we can copy that and come back to our terminal and paste that ID. And now when we run this, we need to give it that password that we generated. So grab your password, and then you can paste your password there. It won't show it. Now when you click enter, it links to your remote project. So now we can create our first migration. So we can [00:39] run npx Supabase db diff. And then we wanna create a new file by diffing the local database. So we can just say local. So it's gonna look at our local database, create the shadow database, diff the 2, and then create a migration file. Okay. Now if we look in our [00:59] migrations folder, we'll see we have a migration. And this is just the SQL for creating our to dos table. So now we can run npx Supabase db push, and this will push our migrations to our remote database. Okay. And then if we come back into [01:19] our project, and we can come to our tables, and refresh. And now in our remote project, we have the to dos table.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!