Maintain order on languages.
parent
5691052a97
commit
e43009f166
|
@ -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 """
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue