-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add default membership flag for test groups
- Loading branch information
1 parent
db0890b
commit b11892b
Showing
14 changed files
with
312 additions
and
21 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
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
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,25 @@ | ||
defmodule Skate.Settings.TestGroupOverride do | ||
@moduledoc false | ||
|
||
use Ecto.Type | ||
|
||
@type t :: :enabled | :disabled | :none | ||
|
||
@impl true | ||
def type, do: :string | ||
|
||
@valid_states [:enabled, :disabled, :none] | ||
|
||
@impl true | ||
def cast(term) when term in @valid_states, do: {:ok, term} | ||
def cast(_), do: :error | ||
|
||
@impl true | ||
def dump(term) when term in @valid_states, do: {:ok, Atom.to_string(term)} | ||
def dump(_), do: :error | ||
|
||
@impl true | ||
def load(term) do | ||
term |> String.to_existing_atom() |> cast() | ||
end | ||
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
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
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
15 changes: 15 additions & 0 deletions
15
priv/repo/migrations/20231220204054_add_override_for_test_groups.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
defmodule Skate.Repo.Migrations.AddOverrideForTestGroups do | ||
use Ecto.Migration | ||
|
||
def change do | ||
# excellent_migrations:safety-assured-for-this-file raw_sql_executed | ||
execute( | ||
"CREATE TYPE test_group_override AS ENUM ('none', 'enabled', 'disabled')", | ||
"DROP TYPE test_group_override" | ||
) | ||
|
||
alter table(:test_groups) do | ||
add(:override, :test_group_override, default: "none", null: false) | ||
end | ||
end | ||
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
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
Oops, something went wrong.