Files
chess-endgame-trainer/priv/repo/migrations/20261101120000_case_insensitive_theme_names.exs
T
owenrees cd2e7f0164 Rename Tag to Theme across code and schema
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
2026-11-02 09:14:17 +01:00

18 lines
452 B
Elixir

defmodule Chesstrainer.Repo.Migrations.CaseInsensitiveThemeNames do
use Ecto.Migration
def up do
drop index(:themes, [:name, :category])
create unique_index(:themes, ["lower(name)", :category],
name: :themes_name_category_lower_index
)
end
def down do
drop index(:themes, ["lower(name)", :category], name: :themes_name_category_lower_index)
create unique_index(:themes, [:name, :category])
end
end