Add Seed Data to Local Database with Supabase

Ben Patton
InstructorBen Patton
Share this video with your friends

Social Share Links

Send Tweet
Published 10 months ago
Updated 3 weeks ago

When npx supabase init, npx supabase start, or npx supabase db reset is run, supabase will look for our seed.sql file and seed our local database.

Since we have already created the project and we want to add seed data, we can run npx supabase db reset.

[00:00] Whenever you start your local instance of Supabase, you'll notice you have the c dot SQL file. Starting off, it'll be empty, but as your project grows, you probably want to have some seed data in this file. So we're just gonna paste some to dos here, and we're gonna save it. Now if you were starting up super bass and ran [00:20] super bass in it, then this would run. If you had already initted super bass and you ran start, then this would run. But since our local instance has already started, we can just say super bass, DB reset. And when we run this, it's gonna reset everything. And then it's gonna run our seed command. And [00:39] then we'll see our data populated over here on the right. Okay. The command has finished running. Now if we come back to our project, we see our to dos.

egghead
egghead

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

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

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!

Markdown supported.
Become a member to join the discussionEnroll Today