Files
usda-vision/docs/SUPABASE_MIGRATION.md

95 lines
2.5 KiB
Markdown

# Supabase Directory Migration
## What Changed
The Supabase configuration has been moved from `management-dashboard-web-app/supabase/` to the project root `supabase/` directory.
## Why This Change?
1. **Better Architecture**: Supabase is shared infrastructure, not specific to the web app
2. **Monorepo Best Practice**: Infrastructure concerns should be at the root level
3. **Easier Access**: Other services (APIs, scripts) can now easily reference the database
4. **Clearer Ownership**: Makes it obvious that Supabase is a project-wide resource
## Migration Steps
### For Docker Compose Users
No action needed! The `docker-compose.yml` has been updated to use the new paths. Just restart your containers:
```bash
docker compose down
docker compose up -d
```
### For Supabase CLI Users
**Before** (old way):
```bash
cd management-dashboard-web-app
supabase start
supabase db reset
```
**After** (new way):
```bash
# From project root - no need to cd!
supabase start
supabase db reset
```
The Supabase CLI automatically looks for the `supabase/` directory in the current working directory, so you can now run all Supabase commands from the project root.
### Updating Your Workflow
If you have scripts or documentation that reference the old path, update them:
-`management-dashboard-web-app/supabase/migrations/`
-`supabase/migrations/`
-`management-dashboard-web-app/supabase/config.toml`
-`supabase/config.toml`
## Current State
The old directory (`management-dashboard-web-app/supabase/`) has been removed. All Supabase and DB configuration, migrations, and seeds now live only under the project root `supabase/` directory. Docker Compose and the Supabase CLI use root `supabase/` exclusively.
## Verification
To verify the migration:
1. **Check docker-compose paths** (only root supabase should be referenced):
```bash
grep "supabase" docker-compose.yml
# Should show only ./supabase/ (no management-dashboard-web-app/supabase/)
```
2. **Test Supabase CLI**:
```bash
# From project root
supabase status
# Should work without needing to cd into management-dashboard-web-app
```
1. **Test migrations**:
```bash
docker compose up -d
docker compose logs supabase-migrate
# Should show migrations running successfully
```
## Benefits
✅ Run Supabase commands from project root
✅ Clearer project structure
✅ Easier to share database across services
✅ Better alignment with monorepo best practices
✅ Infrastructure separated from application code