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:
28
db/migrate/20241027203209_create_mat_assignment_rules.rb
Normal file
28
db/migrate/20241027203209_create_mat_assignment_rules.rb
Normal 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
|
||||
Reference in New Issue
Block a user