Skip to content

Add foreign keys to LiveAttempts#13524

Open
FinnIckler wants to merge 1 commit intothewca:mainfrom
FinnIckler:live-attempts-foreign-key
Open

Add foreign keys to LiveAttempts#13524
FinnIckler wants to merge 1 commit intothewca:mainfrom
FinnIckler:live-attempts-foreign-key

Conversation

@FinnIckler
Copy link
Member

This will fix the issue with orphaned attempts like #13208 and #13418

I currently have added deleting the orphaned result to the migration. Maybe we want to run this manually?

If we do run this first, we need to run both

      DELETE FROM live_attempt_history_entries
      WHERE live_attempt_id IN (
        SELECT id FROM live_attempts
        WHERE live_result_id IS NOT NULL
          AND live_result_id NOT IN (SELECT id FROM live_results)
      )

and

      DELETE FROM live_attempts
      WHERE live_result_id IS NOT NULL
        AND live_result_id NOT IN (SELECT id FROM live_results)

because there is currently no on_delete: cascade for the history entries

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.

1 participant