1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Added a separate table to record background job status for tournaments and fixed migrations/schemas for solid dbs. Foreign key constraints are now added to the migrations where we do belongs_to.

This commit is contained in:
2025-04-15 16:16:44 -04:00
parent 4828d9b876
commit 6e61a7245a
37 changed files with 678 additions and 1169 deletions

View File

@@ -31,14 +31,19 @@ class WrestlingdevImporter
end
def destroy_all
@tournament.mat_assignment_rules.destroy_all
@tournament.mats.destroy_all
# These depend directly on @tournament and will cascade deletes
# due to `dependent: :destroy` in the Tournament model
@tournament.schools.destroy_all # Cascades to Wrestlers, Teampointadjusts, SchoolDelegates
@tournament.weights.destroy_all # Cascades to Wrestlers, Matches
@tournament.mats.destroy_all # Cascades to Matches, MatAssignmentRules
# Explicitly destroy matches again just in case some aren't linked via mats/weights? Unlikely but safe.
# Also handles matches linked directly to tournament if that's possible.
@tournament.matches.destroy_all
@tournament.schools.each do |school|
school.wrestlers.destroy_all
school.destroy
end
@tournament.weights.destroy_all
@tournament.mat_assignment_rules.destroy_all # Explicitly destroy rules (might be redundant if Mat cascades)
@tournament.delegates.destroy_all
@tournament.tournament_backups.destroy_all
@tournament.tournament_job_statuses.destroy_all
# Note: Teampointadjusts are deleted via School/Wrestler cascade
end
def parse_data