This commit is contained in:
@@ -2,50 +2,61 @@ defmodule LoLAnalytics.Repo.Migrations.AnalyticsTables do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table("dom_champion") do
|
||||
add :champion_id, :integer, primary_key: true
|
||||
create table("dim_champion") do
|
||||
add :champion_id, :integer, primary_key: true, null: false
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create table("dom_match") do
|
||||
add :match_id, :integer, primary_key: true
|
||||
create index("dim_champion", [:champion_id], unique: true)
|
||||
|
||||
create table("dim_item") do
|
||||
add :item_id, :integer, primary_key: true, null: false
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index("dom_match", [:match_id], unique: true)
|
||||
create index("dim_item", [:item_id], unique: true)
|
||||
|
||||
create table("dom_patch") do
|
||||
add :patch_number, :string, primary_key: true
|
||||
create table("dim_match") do
|
||||
add :match_id, :string, primary_key: true, null: false
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index("dom_patch", [:patch_number], unique: true)
|
||||
create index("dim_match", [:match_id], unique: true)
|
||||
|
||||
create table("dom_item") do
|
||||
add :item_id, :integer, primary_key: true
|
||||
create table("dim_patch") do
|
||||
add :patch_number, :string, primary_key: true, null: false
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index("dom_item", [:item_id], unique: true)
|
||||
create index("dim_patch", [:patch_number], unique: true)
|
||||
|
||||
create table("dom_summoner_spell") do
|
||||
add :spell_id, :integer, primary_key: true
|
||||
create table("dim_player") do
|
||||
add :puuid, :string, primary_key: true, null: false
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index("dom_summoner_spell", [:spell_id], unique: true)
|
||||
create index("dim_player", [:puuid], unique: true)
|
||||
|
||||
create table("dim_summoner_spell") do
|
||||
add :spell_id, :integer, primary_key: true, null: false
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index("dim_summoner_spell", [:spell_id], unique: true)
|
||||
|
||||
create table("fact_champion_played_game") do
|
||||
add :champion_id, references("dom_champion", with: [champion_id: :champion_id]),
|
||||
primary_key: true
|
||||
|
||||
add :match_id, references("dom_match", with: [match_id: :match_id])
|
||||
add :champion_id, references("dim_champion", column: :champion_id, type: :integer)
|
||||
add :match_id, references("dim_match", column: :match_id, type: :string)
|
||||
add :is_win, :boolean
|
||||
add :game_length_seconds, :integer
|
||||
add :queue_id, :integer
|
||||
add :patch_number, references("dim_patch", column: :patch_number, type: :string)
|
||||
add :team_position, :string
|
||||
add :puuid, references("dim_player", column: :puuid, type: :string)
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index("fact_champion_played_game", [:id, :champion_id, :queue_id])
|
||||
create index("fact_champion_played_game", [:puuid, :match_id], unique: true)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user