Files
BreakEscape/db/migrate/20251128000001_remove_unique_game_constraint.rb
Z. Cliffe Schreuders f0ffb3fdfd Refactor code to remove trailing whitespace and improve readability
- Cleaned up trailing whitespace in `games_controller.rb`, `game.rb`, and `validate_scenario.rb` to enhance code quality and maintain consistency across the codebase.
- Updated migration file `remove_unique_game_constraint.rb` to remove unnecessary whitespace, ensuring a cleaner migration history.
- Improved overall readability of the code by eliminating redundant blank lines in various files.
2025-12-04 23:17:34 +00:00

19 lines
717 B
Ruby

# frozen_string_literal: true
# Remove unique constraint on games to allow multiple games per player+mission
# This is needed for VM/CTF flag integration where each VM set gets its own game instance
class RemoveUniqueGameConstraint < ActiveRecord::Migration[7.0]
def change
# Remove the unique index
remove_index :break_escape_games,
name: 'index_games_on_player_and_mission',
if_exists: true
# Add non-unique index for performance
# This maintains query performance without enforcing uniqueness
add_index :break_escape_games,
[:player_type, :player_id, :mission_id],
name: 'index_games_on_player_and_mission_non_unique'
end
end