-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ex/detours): add detour
:status
field, and populate from chang…
…eset (#2952) * feat(ex/detours): add detour :status field, and populate from changeset This adds a new database column and starts populating it from the changeset function. Once we deploy this and have all instances become aware of the field. We'll then deploy a data migration which adds this to previously made detours, so that there are no running instances without this change to the changeset function * chore(ex/db/detour): add type to field * refactor(ex/detours): move `detour_type` into `Skate.Detours.Db.Detour` * refactor(ex/detours): replace `detour_type` with `Detour.status` * test(ex/detours): add tests for `:status` column * feat(ex/db/detour): set `:status` in changeset when `:state` changes`
- Loading branch information
Showing
7 changed files
with
99 additions
and
13 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
9 changes: 9 additions & 0 deletions
9
priv/repo/migrations/20250131195636_add_detour_status_field.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,9 @@ | ||
defmodule Skate.Repo.Migrations.AddDetourStatusField do | ||
use Ecto.Migration | ||
|
||
def change do | ||
alter table(:detours) do | ||
add :status, :string | ||
end | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
priv/repo/migrations/20250204034128_create_detour_status_index.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,10 @@ | ||
defmodule Skate.Repo.Migrations.CreateDetourStatusIndex do | ||
use Ecto.Migration | ||
|
||
@disable_ddl_transaction true | ||
@disable_migration_lock true | ||
|
||
def change do | ||
create index(:detours, [:status], concurrently: true) | ||
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