lol-analytics/apps/lol_analytics/priv/repo/migrations/20240526160430_analytics_tables.exs
Álvaro 2768e4434a
Some checks failed
ci / docker (push) Failing after 3m32s
add fact processing status migrations
2024-06-22 13:05:18 +02:00

65 lines
2.0 KiB
Elixir

defmodule LoLAnalytics.Repo.Migrations.AnalyticsTables do
use Ecto.Migration
def change do
create table("dim_champion") do
add :champion_id, :integer, primary_key: true, null: false
timestamps()
end
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("dim_item", [:item_id], unique: true)
create table("dim_patch") do
add :patch_number, :string, primary_key: true, null: false
timestamps()
end
create index("dim_patch", [:patch_number], unique: true)
create table("dim_match") do
add :patch_number, references("dim_patch", column: :patch_number, type: :string)
add :match_id, :string, primary_key: true, null: false
timestamps()
end
create index("dim_match", [:patch_number])
create index("dim_match", [:match_id], unique: true)
create table("dim_player") do
add :puuid, :string, primary_key: true, null: false
timestamps()
end
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("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