Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ecto schema prefix config support #184

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/fun_with_flags/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ defmodule FunWithFlags.Config do
adapter: FunWithFlags.Store.Persistent.Redis,
repo: FunWithFlags.NullEctoRepo,
ecto_table_name: "fun_with_flags_toggles",
ecto_schema_prefix: "public",
ecto_primary_key_type: :id
]

Expand Down Expand Up @@ -106,6 +107,15 @@ defmodule FunWithFlags.Config do
end


def ecto_schema_prefix_determined_at_compile_time do
pers_conf = Keyword.merge(
@default_persistence_config,
@compile_time_persistence_config
)
Keyword.get(pers_conf, :ecto_schema_prefix)
end


defp persistence_config do
Keyword.merge(
@default_persistence_config,
Expand Down
1 change: 1 addition & 0 deletions lib/fun_with_flags/store/persistent/ecto/record.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defmodule FunWithFlags.Store.Persistent.Ecto.Record do
alias FunWithFlags.{Config, Gate}

@primary_key {:id, Config.ecto_primary_key_type_determined_at_compile_time(), autogenerate: true}
@schema_prefix Config.ecto_schema_prefix_determined_at_compile_time()

schema Config.ecto_table_name_determined_at_compile_time() do
field :flag_name, :string
Expand Down
Loading