Skip to content

Commit

Permalink
Add migrations to setup categories
Browse files Browse the repository at this point in the history
  • Loading branch information
dmp0x7c5 committed Jan 9, 2018
1 parent b8c5de7 commit b98eaff
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule Eliscore.Repo.Migrations.RemoveCategoryNameStringFromGameMatches do
use Ecto.Migration

def change do
alter table(:game_matches) do
remove :category
end
end
end
12 changes: 12 additions & 0 deletions priv/repo/migrations/20180108195020_create_categories.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
defmodule Eliscore.Repo.Migrations.CreateCategories do
use Ecto.Migration

def change do
create table(:categories) do
add :name, :string

timestamps()
end

end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule Eliscore.Repo.Migrations.GameMatchBelongsToCategory do
use Ecto.Migration

def change do
alter table(:game_matches) do
add :category_id, references(:categories)
end
end
end

0 comments on commit b98eaff

Please sign in to comment.