mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Rename the endgame-label concept from Tag to Theme to match the glossary: the context becomes Chesstrainer.Themes, the schema Chesstrainer.Themes.Theme, and the Endgame association is :themes. The category enum (endgame/opening/tactic) is preserved. Rewrite the original migrations in place so themes / endgames_themes (with theme_id) are created directly, instead of adding a transition migration. Closes #12
13 lines
398 B
Elixir
13 lines
398 B
Elixir
defmodule Chesstrainer.Repo.Migrations.CreateEndgamesThemes do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:endgames_themes, primary_key: false) do
|
|
add :endgame_id, references(:endgames, type: :binary_id, on_delete: :delete_all)
|
|
add :theme_id, references(:themes, on_delete: :delete_all)
|
|
end
|
|
|
|
create unique_index(:endgames_themes, [:endgame_id, :theme_id])
|
|
end
|
|
end
|