-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Users should only be able to delete their own games Show how many users own a copy of each game Issue #71
- Loading branch information
Chris Rees
committed
Mar 11, 2018
1 parent
4b98f3d
commit 8914084
Showing
11 changed files
with
216 additions
and
80 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
priv/repo/migrations/20180310165738_remove_unique_game_name.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
defmodule Nermesterts.Repo.Migrations.RemoveUniqueGameName do | ||
use Ecto.Migration | ||
|
||
def change do | ||
drop unique_index(:games, [:name]) | ||
end | ||
end |
7 changes: 7 additions & 0 deletions
7
priv/repo/migrations/20180310165825_make_player_games_unique.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
defmodule Nermesterts.Repo.Migrations.MakePlayerGamesUnique do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create unique_index(:games, [:bgg_id]) | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
priv/repo/migrations/20180310201717_add_games_to_users.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule Nermesterts.Repo.Migrations.AddGamesToUsers do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:user_games) do | ||
add :user_id, references(:users, on_delete: :delete_all) | ||
add :game_id, references(:games, column: :bgg_id, on_delete: :delete_all) | ||
end | ||
|
||
create unique_index(:user_games, [:user_id, :game_id], name: :unique_user_games_index) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.