From a71c21e5c353f6e246cc8bc23b91a3124eba119a Mon Sep 17 00:00:00 2001
From: Dennis Beatty <dennis@dcbeatty.com>
Date: Thu, 18 Jul 2024 07:24:18 -0600
Subject: [PATCH] remove binary_id support

---
 README.md           | 8 +++-----
 lib/type_id/ecto.ex | 9 ++++-----
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/README.md b/README.md
index 2188d88..3e4f39a 100644
--- a/README.md
+++ b/README.md
@@ -40,11 +40,9 @@ end
 
 ### Underlying types
 
-`TypeID`s can be stored as `:string`, `:binary_id`, or `:binary`. `:string` will
-store the entire TypeID including the prefix. `:binary` and `:binary_id` store
-only the UUID portion and require a `:uuid` or `:binary` column. `:binary_id`
-will use UUIDv4 (non K-sortable), whereas `:binary` will use UUIDv7, so
-`:binary` is recommended over `:binary_id` for that reason.
+`TypeID`s can be stored as either `:string` or `:binary`. `:string` will store
+the entire TypeID including the prefix. `:binary` stores only the UUID portion
+and requires a `:uuid` or `:binary` column.
 
 #### Default type
 
diff --git a/lib/type_id/ecto.ex b/lib/type_id/ecto.ex
index 07abd40..227ddbb 100644
--- a/lib/type_id/ecto.ex
+++ b/lib/type_id/ecto.ex
@@ -48,7 +48,6 @@ if Code.ensure_loaded?(Ecto.ParameterizedType) do
 
       case {tid.prefix, type} do
         {^prefix, :string} -> {:ok, TypeID.to_string(tid)}
-        {^prefix, :binary_id} -> {:ok, TypeID.uuid(tid)}
         {^prefix, :binary} -> {:ok, TypeID.uuid_bytes(tid)}
         _ -> :error
       end
@@ -67,12 +66,12 @@ if Code.ensure_loaded?(Ecto.ParameterizedType) do
       end
     end
 
-    def load(<<_::128>> = uuid, _, %{type: type} = params) when type in [:binary_id, :binary] do
+    def load(<<_::128>> = uuid, _, %{type: :binary} = params) do
       prefix = find_prefix(params)
       TypeID.from_uuid_bytes(prefix, uuid)
     end
 
-    def load(<<_::288>> = uuid, _, %{type: type} = params) when type in [:binary_id, :binary] do
+    def load(<<_::288>> = uuid, _, %{type: :binary} = params) do
       prefix = find_prefix(params)
       TypeID.from_uuid(prefix, uuid)
     rescue
@@ -96,8 +95,8 @@ if Code.ensure_loaded?(Ecto.ParameterizedType) do
         end
       end
 
-      unless type in ~w[string binary_id binary]a do
-        raise ArgumentError, "`type` must be `:string`, `:binary_id`, or `:binary`"
+      unless type in ~w[string binary]a do
+        raise ArgumentError, "`type` must be `:string` or `:binary`"
       end
 
       if primary_key do