Reset a Supabase Database

So you've been wreaking havoc in your Supabase database and have decided the best option is to nuke it... Here's how you can do it.

Step 1: Get the Supabase CLI

First, you'll need the Supabase CLI. If you haven't set it up, head to the Supabase CLI docs and follow the installation instructions. Trust me, it's worth it!

Step 2: Log in

Open your terminal and type:

supabase login

Follow the prompts to authenticate.

Step 3: Link your project

It's time to connect your local setup to your Supabase project. For this, you'll need your project's reference ID. This assumes you have already run supabase init in your project and have a configuration. If you haven't it'll prompt you to run that command first.

You can find the project ref in your Supabase dashboard (it's that long string of letters and numbers).

supabase link --project-ref YOUR_PROJECT_REF_ID

Replace YOUR_PROJECT_REF_ID with your actual project reference ID.

Step 4: Nuke

Now for the moment of truth. Take a deep breath and type:

supabase db reset --linked

Boom! Your database is now as clean as a whistle.

All your tables, data, and that embarrassing typo you made in a column name are gone!

Avatar for Niall Maher

Written by Niall Maher

Founder of Codú - The web developer community! I've worked in nearly every corner of technology businesses: Lead Developer, Software Architect, Product Manager, CTO, and now happily a Founder.

Loading

Fetching comments

Hey! 👋

Got something to say?

or to leave a comment.