Maintain order on languages.

main
Joshua Potter 2023-12-05 16:06:25 -07:00
parent 5691052a97
commit e43009f166
2 changed files with 19 additions and 1 deletions

View File

@ -20,7 +20,9 @@ defmodule BoardWise.Languages do
"""
def list_languages do
Repo.all(Language, prefix: @prefix)
Language
|> order_by(:pos)
|> Repo.all(prefix: @prefix)
end
@doc """

View File

@ -0,0 +1,16 @@
defmodule BoardWise.Repo.Migrations.LanguagePos do
use Ecto.Migration
alias BoardWise.Languages.Language
@prefix "coach_scraper"
def change do
# We'll just recreate all the entries in the table.
BoardWise.Repo.delete_all(Language, prefix: @prefix)
alter table(:languages, prefix: @prefix) do
add :pos, :integer, null: false
end
end
end