Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Game < ApplicationRecord
- belongs_to :first_team, class_name: 'Team', foreign_key: 'first_team_id'
- belongs_to :second_team, class_name: 'Team', foreign_key: 'second_team_id'
- end
- class Team < ApplicationRecord
- has_many :games
- has_many :players
- end
- class Player < ApplicationRecord
- belongs_to :team
- has_many :games
- has_many :ratings
- end
- class Rating < ApplicationRecord
- belongs_to :player
- belongs_to :team
- belongs_to :game
- end
- ActiveRecord::Schema.define(version: 2019_07_16_200658) do
- create_table "games", force: :cascade do |t|
- t.integer "first_team_id"
- t.integer "second_team_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["first_team_id"], name: "index_games_on_first_team_id"
- t.index ["second_team_id"], name: "index_games_on_second_team_id"
- end
- create_table "players", force: :cascade do |t|
- t.integer "team_id"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["team_id"], name: "index_players_on_team_id"
- end
- create_table "ratings", force: :cascade do |t|
- t.integer "player_id"
- t.integer "team_id"
- t.integer "game_id"
- t.float "distance"
- t.float "accuracy"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.index ["game_id"], name: "index_ratings_on_game_id"
- t.index ["player_id"], name: "index_ratings_on_player_id"
- t.index ["team_id"], name: "index_ratings_on_team_id"
- end
- create_table "teams", force: :cascade do |t|
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement