diff --git a/lib/fun_with_flags/config.ex b/lib/fun_with_flags/config.ex index 02667be2..8bbd3187 100644 --- a/lib/fun_with_flags/config.ex +++ b/lib/fun_with_flags/config.ex @@ -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 ] @@ -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, diff --git a/lib/fun_with_flags/store/persistent/ecto/record.ex b/lib/fun_with_flags/store/persistent/ecto/record.ex index ffda5af3..92578a43 100644 --- a/lib/fun_with_flags/store/persistent/ecto/record.ex +++ b/lib/fun_with_flags/store/persistent/ecto/record.ex @@ -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