Skip to content

fix(database): restore cascade delete for study dependencies#806

Open
ibrahimozkn wants to merge 2 commits into
devfrom
fix/study-delete-cascade
Open

fix(database): restore cascade delete for study dependencies#806
ibrahimozkn wants to merge 2 commits into
devfrom
fix/study-delete-cascade

Conversation

@ibrahimozkn
Copy link
Copy Markdown
Contributor

@ibrahimozkn ibrahimozkn commented Mar 23, 2026

Summary

  • restore ON DELETE CASCADE on the study foreign keys used by repo, study_fitbit_credentials, study_invite, and study_subject
  • add a forward migration to safely update existing instances
  • align database/studyu-schema.sql and add a regression test covering study deletion cleanup

Testing

Self-hosted Supabase

  1. Start the local Supabase stack:
    supabase start
  2. Apply the latest database state from this branch on a fresh local instance:
    supabase db reset
  3. Run the SQL test suite, including the new cascade regression coverage:
    supabase test db

Expected result

  • deleting a row from public.study also deletes dependent rows in public.repo, public.study_fitbit_credentials, public.study_invite, and public.study_subject
  • the regression test in supabase/tests/010-study.sql passes

@johannesvedder
Copy link
Copy Markdown
Contributor

The description you added will not work by default when using the seed.sql Use seed-ci.sql for testing to let the supabase tests pass.
with seed.sql
image
With seed-ci.sql as seed.sql
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants