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
- Install Docker/Docker Desktop
- Install Supabase CLI
-
npm install -g env-cmd
- ask for .env file and place it into
code\backend\mb-supabase
-
cd code\backend\mb-supabase
-
env-cmd supabase start
- copy the api url and anon shown in the terminal to
code\presentation\mb-client\.env.development
-
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
some useful commands
supabase link
supabase gen types typescript --linked
supabase db pull
supabase db dump -f supabase/seed.sql --data-only --keep-comments
supabase db reset
env-cmd supabase start
---
supabase gen types typescript --linked