   end
 
 
-  defp mysql_unlock! do
+  defp mysql_unlock!(repo) do
     result = Ecto.Adapters.SQL.query!(
-      ecto_repo(),
+      repo,
       "SELECT RELEASE_LOCK('fun_with_flags_percentage_gate_upsert');"
     )
 

  # PostgreSQL's UPSERTs require an explicit conflict target.
  # MySQL's UPSERTs don't need it.
  #
  defp upsert_options(gate = %Gate{}) do
    options = [on_conflict: [set: [enabled: gate.enabled]]]

    case db_type() do
      :postgres ->
        options ++ [conflict_target: [:flag_name, :gate_type, :target]]
      :mysql ->

  end


  defp postgres_table_lock!(repo) do
    Ecto.Adapters.SQL.query!(
      repo,
      "LOCK TABLE #{ecto_table_name()} IN SHARE ROW EXCLUSIVE MODE;"
    )
  end


  defp mysql_lock!(repo) do
    result = Ecto.Adapters.SQL.query!(
      repo,
      "SELECT GET_LOCK('fun_with_flags_percentage_gate_upsert', #{@mysql_lock_timeout_s})"
    )

