add additional database table connecting game matches to participating players

This commit is contained in:
2026-11-10 01:04:07 +03:00
parent 271daac935
commit 219448ccfb
10 changed files with 103 additions and 3 deletions
+8
View File
@@ -0,0 +1,8 @@
class MatchPlayer < ApplicationRecord
belongs_to :match, foreign_key: :match_uuid, primary_key: :uuid, inverse_of: :match_players
belongs_to :player, class_name: "User", foreign_key: :player_id, inverse_of: :match_players
validates :match_uuid, presence: true
validates :player_id, presence: true
validates :player_id, uniqueness: { scope: :match_uuid }
end