Maintain order on languages.

add-language
Joshua Potter 2023-12-05 16:06:25 -07:00
parent 1c1f8f6fb0
commit c7515b2981
2 changed files with 19 additions and 1 deletions

View File

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