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

Added mat assignment rules for the bout board and fixed the bug where a delegate making the tournamnet info public changes them to the owner

This commit is contained in:
2024-11-25 16:25:59 -05:00
parent bb548be81b
commit ad8e486205
19 changed files with 769 additions and 43 deletions

View File

@@ -0,0 +1,28 @@
class CreateMatAssignmentRules < ActiveRecord::Migration[6.1]
def up
create_table :mat_assignment_rules do |t|
t.references :tournament, null: false, foreign_key: true
t.references :mat, null: false, foreign_key: true
t.json :weight_classes, default: []
t.json :bracket_positions, default: []
t.json :rounds, default: []
t.timestamps
end
# Add unique index on mat_id if it does not already exist
add_index :mat_assignment_rules, :mat_id, unique: true unless index_exists?(:mat_assignment_rules, :mat_id)
# Add index on tournament_id for faster lookups
add_index :mat_assignment_rules, :tournament_id unless index_exists?(:mat_assignment_rules, :tournament_id)
end
def down
# Remove indexes if they exist
remove_index :mat_assignment_rules, :mat_id if index_exists?(:mat_assignment_rules, :mat_id)
remove_index :mat_assignment_rules, :tournament_id if index_exists?(:mat_assignment_rules, :tournament_id)
# Drop the table
drop_table :mat_assignment_rules
end
end