-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
Copy path20220524172636_create_featureflags.exs
50 lines (41 loc) · 1.51 KB
/
20220524172636_create_featureflags.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
defmodule Featureflagservice.Repo.Migrations.CreateFeatureflags do
use Ecto.Migration
def change do
create table(:featureflags) do
add :name, :string
add :description, :string
add :enabled, :float, default: 0.0, null: false
timestamps()
end
create unique_index(:featureflags, [:name])
execute(&execute_up/0, &execute_down/0)
end
defp execute_up do
repo().insert(%Featureflagservice.FeatureFlags.FeatureFlag{
name: "productCatalogFailure",
description: "Fail product catalog service on a specific product",
enabled: 0.0
})
repo().insert(%Featureflagservice.FeatureFlags.FeatureFlag{
name: "recommendationCache",
description: "Cache recommendations",
enabled: 0.0
})
repo().insert(%Featureflagservice.FeatureFlags.FeatureFlag{
name: "adServiceFailure",
description: "Fail ad service requests sporadically",
enabled: 0.0
})
repo().insert(%Featureflagservice.FeatureFlags.FeatureFlag{
name: "cartServiceFailure",
description: "Fail cart service requests sporadically",
enabled: 0.0
})
end
defp execute_down do
repo().delete(%Featureflagservice.FeatureFlags.FeatureFlag{name: "productCatalogFailure"})
repo().delete(%Featureflagservice.FeatureFlags.FeatureFlag{name: "recommendationCache"})
repo().delete(%Featureflagservice.FeatureFlags.FeatureFlag{name: "adServiceFailure"})
repo().delete(%Featureflagservice.FeatureFlags.FeatureFlag{name: "cartServiceFailure"})
end
end