Maintain order on languages.
parent
1c1f8f6fb0
commit
c7515b2981
|
@ -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