Skip to main content

Local Supabase Server

Why?

When working on a feature branch, we can't change the schema of staging/dev db as others testing or working on other branches might face conflicts. To avoid this issue, when working on a feature branch which requires changing schema of the db, local db server MUST BE USED. Once the feature branch is merged, staging/dev db should be migrated accordingly.

Explained in detail here

Setup

  1. Install Docker/Docker Desktop
  2. Install Supabase CLI
  3. npm install -g env-cmd
  4. ask for .env file and place it into code\backend\mb-supabase
  5. cd code\backend\mb-supabase
  6. env-cmd supabase start
  7. copy the api url and anon shown in the terminal to code\presentation\mb-client\.env.development
  8. mb-client should now connect to local db instead of staging db

How to change Schema

  • Follow this guide to create migration for your db
  • dont forget to update the seed too using supabase db dump -f supabase/seed.sql --data-only --local

some useful commands