Getting latest live rule first then the rest of the data using Repo

I know it is a noob question but I can’t seem to figure it out.

I have 1000s of rules in the DB which has a boolean field as is_live and a DateTime field as start_time
A rule is considered a priority rule if it is the latest rule and it is live.

I want to write a Repo query where it returns all the rows first being the priority rule followed by live rule which is no longer priority and the is_live false rules

What I have in my function is as below

def all(%{"rule_set_id" => rule_set_id, "is_archived" => is_archived, "page" => page_number}) do
    page = from(rsv in @model,
      where: rsv.rule_set_id == ^rule_set_id and rsv.is_archived == ^is_archived,
      order_by: [desc: rsv.is_live, desc: rsv.start_time]
    # |> Repo.all()
    # |> preload(@default_preloads)
    |> Repo.paginate(page: page_number, page_size: 5)

    {:ok, %{
           "rule_set_versions" => page.entries |> preload(@custom_preloads),
           "page_number" => page.page_number,
           "page_size" => page.page_size,
           "total_pages" => page.total_pages,
           "total_rows" => page.total_entries

Note: I am using Scrivener Ecto for pagination.

That query doesn’t seem unreasonable; what do you get when you pass it to Repo.to_sql/2?