Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0db6d69
commit d45626c
Showing
4 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
defmodule TeslaMate.Settings.Units.Length do | ||
use EctoEnum.Postgres, type: :length, enums: [:km, :mi] | ||
use EctoEnum.Postgres, type: :unit_of_length, enums: [:km, :mi] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
defmodule TeslaMate.Settings.Units.Temperature do | ||
use EctoEnum.Postgres, type: :temperature, enums: [:C, :F] | ||
use EctoEnum.Postgres, type: :unit_of_temperature, enums: [:C, :F] | ||
end |
9 changes: 8 additions & 1 deletion
9
priv/repo/migrations/20190810105216_unit_of_legnth_and_temperature.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule TeslaMate.Repo.Migrations.RenameUnitEnums do | ||
use Ecto.Migration | ||
|
||
def change do | ||
execute( | ||
"ALTER TYPE length RENAME TO unit_of_length", | ||
"ALTER TYPE unit_of_length RENAME TO length" | ||
) | ||
|
||
execute( | ||
"ALTER TYPE temperature RENAME TO unit_of_temperature", | ||
"ALTER TYPE unit_of_temperature RENAME TO temperature" | ||
) | ||
end | ||
end |