Manage Supabase database - create migrations, push schema changes, generate types, check status. Use when user mentions database, migrations, schema, or supabase.
You are managing the Supabase database for SherlockOS, a detective assistance platform.
| Setting | Value |
|---|---|
| Project Ref | hdfaugwofzqqdjuzcsin |
| Project URL | https://hdfaugwofzqqdjuzcsin.supabase.co |
| Backend Path | /Users/yongkangzou/Desktop/Hackathons/Gemini Hackathon/SherlockOS/backend |
| Migrations | backend/supabase/migrations/ |
| Password | Cool-inin1214 |
cd "/Users/yongkangzou/Desktop/Hackathons/Gemini Hackathon/SherlockOS/backend" && supabase db push
cd "/Users/yongkangzou/Desktop/Hackathons/Gemini Hackathon/SherlockOS/backend" && supabase migration new <migration_name>
Then edit the created file in supabase/migrations/.
cd "/Users/yongkangzou/Desktop/Hackathons/Gemini Hackathon/SherlockOS/backend" && supabase migration list
cd "/Users/yongkangzou/Desktop/Hackathons/Gemini Hackathon/SherlockOS/backend" && supabase db diff
cd "/Users/yongkangzou/Desktop/Hackathons/Gemini Hackathon/SherlockOS/backend" && supabase gen types typescript --project-id hdfaugwofzqqdjuzcsin
cd "/Users/yongkangzou/Desktop/Hackathons/Gemini Hackathon/SherlockOS/backend" && supabase db pull
cd "/Users/yongkangzou/Desktop/Hackathons/Gemini Hackathon/SherlockOS/backend" && supabase db reset
| Table | Description | Key Fields |
|---|---|---|
cases | Investigation cases | id, title, description, created_at |
commits | Timeline entries (append-only) | id, case_id, type, summary, payload |
branches | Hypothesis branches | id, case_id, name, base_commit_id |
scene_snapshots | Current SceneGraph state | case_id, commit_id, scenegraph |
suspect_profiles | Suspect attributes | case_id, attributes, portrait_asset_key |
jobs | Async processing jobs | id, type, status, progress, input, output |
assets | Storage file references | id, case_id, kind, storage_key |
commits - Timeline updatesjobs - Progress trackingWhen making schema changes:
Create migration file:
supabase migration new descriptive_name
Edit the SQL file in backend/supabase/migrations/
Push to remote:
supabase db push
Update Go models in backend/internal/models/ if needed
Run tests:
CGO_ENABLED=0 /usr/local/go/bin/go test ./...
ALTER TABLE table_name ADD COLUMN column_name data_type;
CREATE INDEX idx_name ON table_name(column_name);
ALTER TABLE child_table
ADD CONSTRAINT fk_name
FOREIGN KEY (column) REFERENCES parent_table(id);
ALTER PUBLICATION supabase_realtime ADD TABLE table_name;
If supabase db push fails:
supabase link --project-ref hdfaugwofzqqdjuzcsinsupabase db diff