BUG: Creating tables fails with incorrect schema.sql
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Open supabase/schemas/schema.sql and compare its table order, commas, foreign-key references, and therapy_type definition with the issue details and the TherapyTypeModel. Run the complete script in the Supabase SQL Editor. Done means all tables and indexes are created in one run without syntax or missing-relation errors.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
This issue and related PR were fully identified and analyzed by myself. Claude was only used to assist with writing descriptions in English.
📌 Issue Overview
schema.sql fails to execute when copied into the Supabase SQL Editor due to multiple syntax errors, missing table definitions, and incorrect table declaration order.
Previous PR #146 also indicates syntax error, and I found more errors.
🔍 Steps to Reproduce
- Go to Supabase Dashboard → SQL Editor
- Copy and paste the entire contents of
supabase/schemas/schema.sqlguided by README - Click Run
- See the error:
ERROR: 42601: syntax error at or near ")"
ERROR: 42P01: relation "therapist" does not exist
ERROR: 42P01: relation "therapy_type" does not exist
🎯 Expected Behavior
The full schema.sql should execute in a single run, creating all tables and indexes without errors.
🚨 Actual Behavior
Execution fails due to the following issues:
- Table declaration order:
patientis declared beforetherapist, butpatient.therapist_idreferencestherapist(id). Similarly,therapy_goalreferencestherapy_type(id)which is declared later. - Trailing commas:
therapist,session,observation_master,activity_master,daily_activities, anddaily_activity_logshave a trailing comma after the last column definition. - Missing comma:
daily_activity_logsis missing a comma afteractivity_items JSONB NOT NULL. - Missing table:
therapy_goal.therapy_type_idreferencestherapy_type(id), but thetherapy_typetable is not defined in the schema. - Dead column:
therapy_goal.therapy_type INT2is not used anywhere in the codebase.
📷 Screenshot
N/A
💡 Suggested Improvements
All fixes have already been applied to schema.sql and verified by successfully executing the full script in the Supabase SQL Editor without errors. A PR is ready to be submitted with the following changes:
- Reordered table declarations to respect FK dependencies (
therapistbeforepatient,therapy/therapy_typebeforetherapy_goal) - Added
therapy_typetable matching theTherapyTypeModelin the codebase (id,created_at,name,description) - Removed all trailing commas
- Added the missing comma in
daily_activity_logs - Removed the unused
therapy_goal.therapy_type INT2column
Have same concern with issue #153 , but this is currently occurring error, so it should be fixed whether we use Supabase as backend or not.
Record
- I agree to follow this project's Code of Conduct
- I want to work on this issue
- Dominant language
- Dart
- Stars
- 30
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/NeuroTrack
-
fix(therapist): Method marked @override does not override any inherited methodPossibly taken @Muneerali199 claimed this 259 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AOSSIE-Org/NeuroTrack#198 ·
-
fix: Don't use BuildContext across async gaps (use_build_context_synchronously)Possibly taken @Muneerali199 claimed this 259 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AOSSIE-Org/NeuroTrack#197 ·
-
fix(patient): Remove unused and duplicate imports across patient appPossibly taken @Muneerali199 claimed this 259 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AOSSIE-Org/NeuroTrack#195 ·
-
BUG: Therapy details save button has no loading guard, allowing duplicate submissions that inflate patient regression reportsPossibly taken @Varadraj75 claimed this 222 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 68/100
AOSSIE-Org/NeuroTrack#221 ·
-
BUG: Appointment booking ignores selected time slot, every appointment saved at midnight to SupabasePossibly taken @Varadraj75 claimed this 227 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
AOSSIE-Org/NeuroTrack#219 ·
All issues in AOSSIE-Org/NeuroTrack
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Anxcye/anx-reader#1024 ·
-
[cloud_functions]: Apple platforms ignore custom domains passed as regionPossibly taken @ragavendranbala-TSL claimed this today. OpenNeeds Attention platform: ios platform: macos plugin: functions type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
firebase/flutterfire#19015 · 2 comments ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RevenueCat/purchases-flutter#2048 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
hajisensai/Fushi#4543 · 3 comments ·
Maintainers usually reply within 1 day
-
[video_player] _updatePosition sets isCompleted=true after 500ms when duration is Duration.zeroOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day