 
   defp do_insert(flag_name, changeset, options \\ []) do
     changeset
-    |> @repo.insert(options)
+    |> ecto_repo().insert(options)
     |> handle_write(flag_name)
   end
 
 
   defp do_update(flag_name, changeset, options \\ []) do
     changeset
-    |> @repo.update(options)
+    |> ecto_repo().update(options)
     |> handle_write(flag_name)
   end
 

    end

    out = transaction_fn.(fn() ->
      case @repo.one(find_one_q) do
        record = %Record{} ->
          changeset = Record.update_target(record, gate)
          do_update(flag_name, changeset)

    name_string = to_string(flag_name)
    query = from(r in Record, where: r.flag_name == ^name_string)
    try do
      results = ecto_repo().all(query)
      flag = deserialize(flag_name, results)
      {:ok, flag}
    rescue
