Member-only story
Transfer Your Local PostgreSQL Database to Supabase
3 min readOct 6, 2023
Introduction
Recently, I’ve seen many people asking how to move their PostgreSQL database to Supabase. They want a clear guide to help them switch without losing data or causing too much downtime. The process is straightforward, let me show you!
Prerequisites
- A local/remote PostgreSQL database you wanna migrate to Supabase.
- A Supabase account (you can sign up for free).
- Basic knowledge of PostgreSQL commands.
For this example, I have created a table called User with the fields: id
, name
, lastname
and age
, really simple, just for demonstration purposes:
Step-by-Step Guide to Migrating Your Database
Backup Your Local Database
Before making any changes, it’s crucial to back up your local database to prevent any data loss.
pg_dump 'postgres://{user}:{password}@{hostname}:{port}/{database-name}' > database_dump.dump