From 639136fd14b302369c96b65b3f398dd7879155af Mon Sep 17 00:00:00 2001 From: Siddhant Date: Thu, 20 May 2021 17:10:43 +0530 Subject: [PATCH 1/2] feature: support for the uuid as primary key --- lib/spur/activity.ex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/spur/activity.ex b/lib/spur/activity.ex index fe49469..a8e7c75 100644 --- a/lib/spur/activity.ex +++ b/lib/spur/activity.ex @@ -3,6 +3,11 @@ defmodule Spur.Activity do import Ecto.Changeset + if Application.get_env(:spur, :uuid_primary_key_enabled, false) do + @primary_key {:id, :binary_id, autogenerate: true} + @foreign_key_type :binary_id + end + schema Application.get_env(:spur, :activities_table_name, "activities") do field(:action, :string) field(:actor, :string) From d01d5a9f41e95f51ef6e8e00c2f9af12666e93c3 Mon Sep 17 00:00:00 2001 From: Siddhant Date: Thu, 20 May 2021 17:13:29 +0530 Subject: [PATCH 2/2] refactor: changing the ecto sql version to support uuid --- mix.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 22c280a..d7ef380 100644 --- a/mix.exs +++ b/mix.exs @@ -32,8 +32,8 @@ defmodule Spur.MixProject do defp deps do [ {:ex_doc, ">= 0.0.0", only: :dev}, - {:ecto, "~> 3.0"}, - {:ecto_sql, "~> 3.0", only: :test}, + {:ecto, "~> 3.6"}, + {:ecto_sql, "~> 3.6", only: :test}, {:postgrex, "~> 0.14", only: :test}, {:jason, "~> 1.0", only: :test}, {:atomic_map, "~> 0.9"}